9 Some Examples of Domains and Packages
9.83 UnivariatePolynomial
The domain constructor UnivariatePolynomial (abbreviated UP) creates domains of univariate polynomials in a specified
variable. For example, the domain UP(a1,POLY FRAC INT) provides
polynomials in the single variable a1 whose coefficients are
general polynomials with rational number coefficients.
Restriction:
Axiom does not allow you to create types where
UnivariatePolynomial is contained in the coefficient type of
Polynomial. Therefore,
UP(x,POLY INT) is legal but POLY UP(x,INT) is not.
.
UP(x,INT) is the domain of polynomials in the single
variable x with integer coefficients.
Void
p := (3*x-1)**2 * (2*x + 8)
Type: UnivariatePolynomial(x,Integer)
q := (1 - 6*x + 9*x**2)**2
Type: UnivariatePolynomial(x,Integer)
The usual arithmetic operations are available for univariate polynomials.
|
Type: UnivariatePolynomial(x,Integer)
The operation leadingCoefficientleadingCoefficientUnivariatePolynomial
extracts the coefficient of the term of highest degree.
Type: PositiveInteger
The operation degreedegreeUnivariatePolynomial returns
the degree of the polynomial.
Since the polynomial has only one variable, the variable is not supplied
to operations like degreedegreeUnivariatePolynomial.
Type: PositiveInteger
The reductum of the polynomial, the polynomial obtained by subtracting
the term of highest order, is returned by
reductumreductumUnivariatePolynomial.
Type: UnivariatePolynomial(x,Integer)
The operation gcdgcdUnivariatePolynomial computes the
greatest common divisor of two polynomials.
Type: UnivariatePolynomial(x,Integer)
The operation lcmlcmUnivariatePolynomial computes the
least common multiple.
|
Type: UnivariatePolynomial(x,Integer)
The operation resultantresultantUnivariatePolynomial computes
the resultant of two univariate polynomials. In the case of p
and q, the resultant is 0 because they share a common
root.
Type: NonNegativeInteger
To compute the derivative of a univariate polynomial with respect to its
variable, use DDUnivariatePolynomial.
Type: UnivariatePolynomial(x,Integer)
Univariate polynomials can also be used as if they were functions. To
evaluate a univariate polynomial at some point, apply the polynomial
to the point.
Type: PositiveInteger
The same syntax is used for composing two univariate polynomials, i.e.
substituting one polynomial for the variable in another. This
substitutes q for the variable in p.
|
Type: UnivariatePolynomial(x,Integer)
This substitutes p for the variable in q.
|
Type: UnivariatePolynomial(x,Integer)
To obtain a list of coefficients of the polynomial, use
coefficientscoefficientsUnivariatePolynomial.
Type: List Integer
From this you can use gcdgcdUnivariatePolynomial and
reducereduceList to compute the content of the polynomial.
Type: PositiveInteger
Alternatively (and more easily), you can just call
contentcontentUnivariatePolynomial.
Type: PositiveInteger
Note that the operation
coefficientscoefficientsUnivariatePolynomial omits the zero
coefficients from the list. Sometimes it is useful to convert a
univariate polynomial to a vector whose -th position contains the
degree i-1 coefficient of the polynomial.
ux := (x**4+2*x+3)::UP(x,INT)
Type: UnivariatePolynomial(x,Integer)
To get a complete vector of coefficients, use the operation
vectorisevectoriseUnivariatePolynomial, which takes a
univariate polynomial and an integer denoting the length of the
desired vector.
Type: Vector Integer
It is common to want to do something to every term of a polynomial,
creating a new polynomial in the process.
This is a function for iterating across the terms of a polynomial,
squaring each term.
squareTerms(p) == reduce(+,[t**2 for t in monomials p])
Void
Recall what p looked like.
Type: UnivariatePolynomial(x,Integer)
We can demonstrate squareTerms on p.
Compiling function squareTerms with type
UnivariatePolynomial(x,Integer) ->
UnivariatePolynomial(x,Integer)
Type: UnivariatePolynomial(x,Integer)
When the coefficients of the univariate polynomial belong to a
field, it is
possible to compute quotients and remainders.
Void
Type: UnivariatePolynomial(a1,Fraction Integer)
Type: UnivariatePolynomial(a1,Fraction Integer)
When the coefficients are rational numbers or rational expressions, the
operation quoquoUnivariatePolynomial computes the quotient
of two polynomials.
Type: UnivariatePolynomial(a1,Fraction Integer)
The operation remremUnivariatePolynomial computes the
remainder.
Type: UnivariatePolynomial(a1,Fraction Integer)
The operation dividedivideUnivariatePolynomial can be used to
return a record of both components.
|
Type:
Record(
quotient: UnivariatePolynomial(a1,Fraction Integer),
remainder: UnivariatePolynomial(a1,Fraction Integer))
Now we check the arithmetic!
r - (d.quotient * s + d.remainder)
Type: UnivariatePolynomial(a1,Fraction Integer)
It is also possible to integrate univariate polynomials when the
coefficients belong to a field.
Type: UnivariatePolynomial(a1,Fraction Integer)
Type: UnivariatePolynomial(a1,Fraction Integer)
One application of univariate polynomials is to see expressions in terms
of a specific variable.
We start with a polynomial in a1 whose coefficients
are quotients of polynomials in b1 and b2.
Void
Since in this case we are not talking about using multivariate
polynomials in only two variables, we use Polynomial.
We also use Fraction because we want fractions.
t := a1**2 - a1/b2 + (b1**2-b1)/(b2+3)
Type: UnivariatePolynomial(a1,Fraction Polynomial Integer)
We push all the variables into a single quotient of polynomials.
|
Type: Fraction Polynomial Integer
Alternatively, we can view this as a polynomial in the variable
This is a mode-directed conversion: you indicate
as much of the structure as you care about and let Axiom
decide on the full type and how to do the transformation.
|
Type: UnivariatePolynomial(b1,Fraction Polynomial Integer)
See ugProblemFactorPage in Section
ugProblemFactorNumber
for a discussion of the factorization facilities
in Axiom for univariate polynomials.
For more information on related topics, see
ugIntroVariablesPage in Section
ugIntroVariablesNumber ,
ugTypesConvertPage in Section
ugTypesConvertNumber ,
PolynomialXmpPage ,
MultivariatePolynomialXmpPage , and
DistributedMultivariatePolynomialXmpPage .
9.84 UniversalSegment
The UniversalSegment domain generalizes Segment
by allowing segments without a ``hi'' end point.
Type: UniversalSegment PositiveInteger
Type: UniversalSegment NonNegativeInteger
Values of type Segment are automatically converted to
type UniversalSegment when appropriate.
useg: UniversalSegment(Integer) := 3..10
Type: UniversalSegment Integer
The operation hasHihasHiUniversalSegment is used to test
whether a segment has a hi end point.
Type: Boolean
Type: Boolean
Type: Boolean
All operations available on type Segment apply to UniversalSegment, with the proviso that expansions produce streams
rather than lists. This is to accommodate infinite expansions.
|
Type: Stream Integer
|
Type: Stream Integer
expand [1, 3, 10..15, 100..]
|
Type: Stream Integer
For more information on related topics, see
SegmentXmpPage ,
SegmentBindingXmpPage ,
ListXmpPage , and
StreamXmpPage .
9.85 Vector
The Vector domain is used for storing data in a one-dimensional
indexed data structure. A vector is a homogeneous data structure in
that all the components of the vector must belong to the same Axiom
domain. Each vector has a fixed length specified by the user; vectors
are not extensible. This domain is similar to the
OneDimensionalArray domain, except that when the components of a
Vector belong to a Ring, arithmetic operations are provided.
For more examples of operations that are defined for both Vector
and OneDimensionalArray, see
OneDimensionalArrayXmpPage .
As with the OneDimensionalArray domain, a Vector can
be created by calling the operation newnewVector, its components
can be accessed by calling the operations elteltVector and
qeltqeltVector, and its components can be reset by calling the
operations seteltseteltVector and
qseteltqseteltVector.
This creates a vector of integers of length 5 all of whose
components are 12.
u : VECTOR INT := new(5,12)
Type: Vector Integer
This is how you create a vector from a list of its components.
v : VECTOR INT := vector([1,2,3,4,5])
Type: Vector Integer
Indexing for vectors begins at 1. The last element has index
equal to the length of the vector, which is computed by
#.
Type: PositiveInteger
This is the standard way to use elteltVector to extract
an element. Functionally, it is the same as if you had typed elt(v,2).
Type: PositiveInteger
This is the standard way to use seteltseteltVector to change
an element. It is the same as if you had typed setelt(v,3,99).
Type: PositiveInteger
Now look at v to see the change. You can use
qeltqeltVector and qseteltqseteltVector (instead
of elteltVector and seteltseteltVector,
respectively) but only when you know that the index is within
the valid range.
Type: Vector Integer
When the components belong to a Ring, Axiom provides arithmetic
operations for Vector. These include left and right scalar
multiplication.
Type: Vector Integer
Type: Vector Integer
w : VECTOR INT := vector([2,3,4,5,6])
Type: Vector Integer
Addition and subtraction are also available.
Type: Vector Integer
Of course, when adding or subtracting, the two vectors must have the same
length or an error message is displayed.
Type: Vector Integer
For more information about other aggregate domains, see the following:
ListXmpPage ,
MatrixXmpPage ,
OneDimensionalArrayXmpPage ,
SetXmpPage ,
TableXmpPage , and
TwoDimensionalArrayXmpPage .
Issue the system command )show Vector to display the full list of
operations defined by Vector.
9.86 Void
When an expression is not in a value context, it is given type
Void. For example, in the expression
r := (a; b; if c then d else e; f)
values are used only from the
subexpressions c and f: all others are thrown away. The
subexpressions a, b, d and e are evaluated for
side-effects only and have type Void. There is a unique value
of type Void.
You will most often see results of type Void when you
declare a variable.
Void
Usually no output is displayed for Void results.
You can force the display of a rather ugly object by issuing
)set message void on.
Type: Void
All values can be converted to type Void.
Void
Once a value has been converted to Void, it cannot be recovered.
Cannot convert from type Void to PositiveInteger for value "()"
9.87 WuWenTsunTriangularSet
The WuWenTsunTriangularSet domain constructor implements the
characteristic set method of Wu Wen Tsun. This algorithm computes a
list of triangular sets from a list of polynomials such that the
algebraic variety defined by the given list of polynomials decomposes
into the union of the regular-zero sets of the computed triangular
sets. The constructor takes four arguments. The first one, R,
is the coefficient ring of the polynomials; it must belong to the
category IntegralDomain. The second one, E, is the
exponent monoid of the polynomials; it must belong to the category
OrderedAbelianMonoidSup. The third one, V, is the ordered
set of variables; it must belong to the category OrderedSet.
The last one is the polynomial ring; it must belong to the category
RecursivePolynomialCategory(R,E,V). The abbreviation for
WuWenTsunTriangularSet is WUTSET.
Let us illustrate the facilities by an example.
Define the coefficient ring.
Type: Domain
Define the list of variables,
ls : List Symbol := [x,y,z,t]
Type: List Symbol
and make it an ordered set;
|
Type: Domain
then define the exponent monoid.
|
Type: Domain
Define the polynomial ring.
|
Type: Domain
Let the variables be polynomial.
Type:
NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
Type:
NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
Type:
NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
Type:
NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
Now call the WuWenTsunTriangularSet domain constructor.
|
Type: Domain
Define a polynomial system.
p1 := x ** 31 - x ** 6 - x - y
Type:
NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
Type:
NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
Type:
NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
Type:
List NewSparseMultivariatePolynomial(Integer,OrderedVariableList [x,y,z,t])
Compute a characteristic set of the system.
|
Type:
Union(
WuWenTsunTriangularSet(Integer,
IndexedExponents OrderedVariableList [x,y,z,t],
OrderedVariableList [x,y,z,t],
NewSparseMultivariatePolynomial(Integer,
OrderedVariableList [x,y,z,t])),...)
Solve the system.
|
Type:
List WuWenTsunTriangularSet(Integer,
IndexedExponents OrderedVariableList [x,y,z,t],
OrderedVariableList [x,y,z,t],
NewSparseMultivariatePolynomial(Integer,
OrderedVariableList [x,y,z,t]))
The RegularTriangularSet and
SquareFreeRegularTriangularSet domain constructors, the
LazardSetSolvingPackage package constructors as well as,
SquareFreeRegularTriangularSet and
ZeroDimensionalSolvePackage package constructors also provide
operations to compute triangular decompositions of algebraic
varieties. These five constructor use a special kind of
characteristic sets, called regular triangular sets. These special
characteristic sets have better properties than the general ones.
Regular triangular sets and their related concepts are presented in
the paper ``On the Theories of Triangular sets'' By P. Aubry, D. Lazard
and M. Moreno Maza (to appear in the Journal of Symbolic Computation).
The decomposition algorithm (due to the third author) available in the
four above constructors provide generally better timings than the
characteristic set method. In fact, the WUTSET constructor
remains interesting for the purpose of manipulating characteristic
sets whereas the other constructors are more convenient for solving
polynomial systems.
Note that the way of understanding triangular decompositions
is detailed in the example of the RegularTriangularSet
constructor.
9.88 XPBWPolynomial
Initialisations
Type: Symbol
Type: Symbol
Type: Domain
word := OrderedFreeMonoid Symbol
Type: Domain
lword := LyndonWord(Symbol)
Type: Domain
base := PoincareBirkhoffWittLyndonBasis Symbol
|
Type: Domain
dpoly := XDistributedPolynomial(Symbol, RN)
|
Type: Domain
rpoly := XRecursivePolynomial(Symbol, RN)
|
Type: Domain
lpoly := LiePolynomial(Symbol, RN)
|
Type: Domain
poly := XPBWPolynomial(Symbol, RN)
|
Type: Domain
liste : List lword := LyndonWordsList([a,b], 6)
|
Type: List LyndonWord Symbol
Let's make some polynomials
Type: XPBWPolynomial(Symbol,Fraction Integer)
Type: XPBWPolynomial(Symbol,Fraction Integer)
Type: XPBWPolynomial(Symbol,Fraction Integer)
Type: XPBWPolynomial(Symbol,Fraction Integer)
Type: XPBWPolynomial(Symbol,Fraction Integer)
Coerce to distributed polynomial
Type: XDistributedPolynomial(Symbol,Fraction Integer)
Check some polynomial operations
Type: XPBWPolynomial(Symbol,Fraction Integer)
|
Type:
List Record(k: PoincareBirkhoffWittLyndonBasis Symbol,c: Fraction Integer)
Type: XPBWPolynomial(Symbol,Fraction Integer)
Type: PoincareBirkhoffWittLyndonBasis Symbol
Type: List Fraction Integer
Type:
Record(k: PoincareBirkhoffWittLyndonBasis Symbol,c: Fraction Integer)
Type: PositiveInteger
|
Type: XPBWPolynomial(Symbol,Fraction Integer)
Type: XPBWPolynomial(Symbol,Fraction Integer)
Calculations with verification in XDistributedPolynomial.
lp1 :lpoly := LiePoly liste.10
Type: LiePolynomial(Symbol,Fraction Integer)
lp2 :lpoly := LiePoly liste.11
Type: LiePolynomial(Symbol,Fraction Integer)
Type: LiePolynomial(Symbol,Fraction Integer)
|
Type: XDistributedPolynomial(Symbol,Fraction Integer)
|
Type: XDistributedPolynomial(Symbol,Fraction Integer)
lpd : dpoly := lpd1 * lpd2 - lpd2 * lpd1
|
Type: XDistributedPolynomial(Symbol,Fraction Integer)
Type: XDistributedPolynomial(Symbol,Fraction Integer)
Calculations with verification in XRecursivePolynomial.
Type: XPBWPolynomial(Symbol,Fraction Integer)
Type: XPBWPolynomial(Symbol,Fraction Integer)
Type: XPBWPolynomial(Symbol,Fraction Integer)
|
Type: XRecursivePolynomial(Symbol,Fraction Integer)
|
Type: XRecursivePolynomial(Symbol,Fraction Integer)
Type: XRecursivePolynomial(Symbol,Fraction Integer)
9.89 XPolynomial
The XPolynomial domain constructor implements multivariate
polynomials whose set of variables is Symbol. These variables
do not commute. The only parameter of this construtor is the
coefficient ring which may be non-commutative. However, coefficients
and variables commute. The representation of the polynomials is
recursive. The abbreviation for XPolynomial is XPOLY.
Other constructors like XPolynomialRing,
XRecursivePolynomial as well as XDistributedPolynomial,
LiePolynomial and XPBWPolynomial implement multivariate
polynomials in non-commutative variables.
We illustrate now some of the facilities of the
XPOLY domain constructor.
Define a polynomial ring over the integers.
poly := XPolynomial(Integer)
Type: Domain
Define a first polynomial,
Type: XPolynomial Integer
and a second one.
|
Type: XPolynomial Integer
Rewrite pr in a distributive way,
Type: XDistributedPolynomial(Symbol,Integer)
compute its square,
|
Type: XDistributedPolynomial(Symbol,Integer)
and checks that:
Type: XDistributedPolynomial(Symbol,Integer)
We define:
|
Type: XPolynomial Integer
and:
|
Type: XDistributedPolynomial(Symbol,Integer)
We truncate qd at degree 3:
|
Type: XDistributedPolynomial(Symbol,Integer)
The same for qr:
|
Type: XPolynomial Integer
We define:
Word := OrderedFreeMonoid Symbol
Type: Domain
and:
Type: OrderedFreeMonoid Symbol
The we can compute the right-quotient of qr by r:
Type: XPolynomial Integer
and the shuffle-product of pr by r:
|
Type: XPolynomial Integer
9.90 XPolynomialRing
The XPolynomialRing domain constructor implements generalized
polynomials with coefficients from an arbitrary Ring (not
necessarily commutative) and whose exponents are words from an
arbitrary OrderedMonoid (not necessarily commutative too). Thus
these polynomials are (finite) linear combinations of words.
This constructor takes two arguments. The first one is a Ring
and the second is an OrderedMonoid. The abbreviation for
XPolynomialRing is XPR.
Other constructors like XPolynomial, XRecursivePolynomial
XDistributedPolynomial, LiePolynomial and
XPBWPolynomial implement multivariate polynomials in non-commutative
variables.
We illustrate now some of the facilities of the XPR domain constructor.
Define the free ordered monoid generated by the symbols.
Word := OrderedFreeMonoid(Symbol)
Type: Domain
Define the linear combinations of these words with integer coefficients.
|
Type: Domain
Then we define a first element from poly.
p:poly := 2 * x - 3 * y + 1
Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
And a second one.
Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
We compute their sum,
Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
their product,
Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
and see that variables do not commute.
Type: XPolynomialRing(Integer,OrderedFreeMonoid Symbol)
Now we define a ring of square matrices,
M := SquareMatrix(2,Fraction Integer)
|
Type: Domain
and the linear combinations of words with these matrices as coefficients.
|
Type: Domain
Define a first matrix,
m1:M := matrix [ [i*j**2 for i in 1..2] for j in 1..2]
Type: SquareMatrix(2,Fraction Integer)
a second one,
Type: SquareMatrix(2,Fraction Integer)
and a third one.
Type: SquareMatrix(2,Fraction Integer)
Define a polynomial,
pm:poly1 := m1*x + m2*y + m3*z - 2/3
|
Type:
XPolynomialRing(
SquareMatrix(2,Fraction Integer),
OrderedFreeMonoid Symbol)
a second one,
|
Type:
XPolynomialRing(
SquareMatrix(2,Fraction Integer),
OrderedFreeMonoid Symbol)
and the following power.
|
Type: XPolynomialRing(SquareMatrix(2,Fraction Integer),OrderedFreeMonoid Symbol)
9.91 ZeroDimensionalSolvePackage
The ZeroDimensionalSolvePackage package constructor provides
operations for computing symbolically the complex or real roots of
zero-dimensional algebraic systems.
The package provides no multiplicity information (i.e. some
returned roots may be double or higher) but only distinct roots are
returned.
Complex roots are given by means of univariate representations of
irreducible regular chains. These representations are computed by the
univariateSolveunivariateSolveZeroDimensionalSolvePackage operation
(by calling the InternalRationalUnivariateRepresentationPackage
package constructor which does the job).
Real roots are given by means of tuples of coordinates lying in the
RealClosure of the coefficient ring. They are computed by the
realSolverealSolveZeroDimensionalSolvePackage and
positiveSolvepositiveSolveZeroDimensionalSolvePackage operations.
The former computes all the solutions of the input system with real
coordinates whereas the later concentrate on the solutions with
(strictly) positive coordinates. In both cases, the computations are
performed by the RealClosure constructor.
Both computations of complex roots and real roots rely on triangular
decompositions. These decompositions can be computed in two different
ways. First, by a applying the
zeroSetSplitzeroSetSplitRegularTriangularSet operation from the
REGSET domain constructor. In that case, no Groebner bases are
computed. This strategy is used by default. Secondly, by applying
the zeroSetSplitzeroSetSplitLexTriangularPackage from
LEXTRIPK. To use this later strategy with the operations
univariateSolveunivariateSolveZeroDimensionalSolvePackage,
realSolverealSolveZeroDimensionalSolvePackage and
positiveSolvepositiveSolveZeroDimensionalSolvePackage one just
needs to use an extra boolean argument.
Note that the way of understanding triangular decompositions
is detailed in the example of the RegularTriangularSet
constructor.
The ZeroDimensionalSolvePackage constructor takes three
arguments. The first one R is the coefficient ring; it must
belong to the categories OrderedRing, EuclideanDomain,
CharacteristicZero and RealConstant. This means
essentially that R is Integer or Fraction(Integer).
The second argument ls is the list of variables involved in the
systems to solve. The third one MUST BE concat(ls,s) where
s is an additional symbol used for the univariate representations.
The abbreviation for ZeroDimensionalSolvePackage is ZDSOLVE.
We illustrate now how to use the constructor ZDSOLVE by two
examples: the Arnborg and Lazard system and the L-3 system
(Aubry and Moreno Maza). Note that the use of this package is also
demonstrated in the example of the LexTriangularPackage
constructor.
Define the coefficient ring.
Type: Domain
Define the lists of variables:
ls : List Symbol := [x,y,z,t]
Type: List Symbol
and:
ls2 : List Symbol := [x,y,z,t,new()$Symbol]
Type: List Symbol
Call the package:
pack := ZDSOLVE(R,ls,ls2)
|
Type: Domain
Define a polynomial system (Arnborg-Lazard)
p1 := x**2*y*z + x*y**2*z + x*y*z**2 + x*y*z + x*y + x*z + y*z
|
Type: Polynomial Integer
p2 := x**2*y**2*z + x*y**2*z**2 + x**2*y*z + x*y*z + y*z + x + z
|
Type: Polynomial Integer
p3 := x**2*y**2*z**2 + x**2*y**2*z + x*y**2*z + x*y*z + x*z + z + 1
|
Type: Polynomial Integer
|
Type: List Polynomial Integer
Note that these polynomials do not involve the variable t;
we will use it in the second example.
First compute a decomposition into regular chains (i.e. regular
triangular sets).
|
Type: List RegularChain(Integer,[x,y,z,t])
We can see easily from this decomposition (consisting of a single
regular chain) that the input system has 20 complex roots.
Then we compute a univariate representation of this regular chain.
|
Type:
List Record(
complexRoots: SparseUnivariatePolynomial Integer,
coordinates: List Polynomial Integer)
We see that the zeros of our regular chain are split into three components.
This is due to the use of univariate polynomial factorization.
Each of these components consist of two parts. The first one is an
irreducible univariate polynomial p(?) which defines a simple
algebraic extension of the field of fractions of R. The second
one consists of multivariate polynomials pol1(x,%A),
pol2(y,%A) and pol3(z,%A). Each of these polynomials involve
two variables: one is an indeterminate x, y or z of
the input system lp and the other is %A which represents
any root of p(?). Recall that this %A is the last
element of the third parameter of ZDSOLVE. Thus any complex
root ? of p(?) leads to a solution of the input system
lp by replacing %A by this ? in pol1(x,%A),
pol2(y,%A) and pol3(z,%A). Note that the polynomials
pol1(x,%A), pol2(y,%A) and pol3(z,%A) have degree
one w.r.t. x, y or z respectively. This is always
the case for all univariate representations. Hence the operation
univariateSolve replaces a system of multivariate polynomials by a
list of univariate polynomials, what justifies its name. Another
example of univariate representations illustrates the
LexTriangularPackage package constructor.
We now compute the solutions with real coordinates:
|
Type: List List RealClosure Fraction Integer
The number of real solutions for the input system is:
Type: PositiveInteger
Each of these real solutions is given by a list of elements in
RealClosure(R). In these 8 lists, the first element is a value of
z, the second of y and the last of x. This is
logical since by setting the list of variables of the package to
[x,y,z,t] we mean that the elimination ordering on the variables is
t < z < y < x . Note that each system treated by the
ZDSOLVE package constructor needs only to be zero-dimensional
w.r.t. the variables involved in the system it-self and not
necessarily w.r.t. all the variables used to define the package.
We can approximate these real numbers as follows.
This computation takes between 30 sec. and 5 min, depending on your machine.
[ [approximate(r,1/1000000) for r in point] for point in lr]
|
Type: List List Fraction Integer
We can also concentrate on the solutions with real (strictly) positive
coordinates:
lpr := positiveSolve(lp)$pack
Type: List List RealClosure Fraction Integer
Thus we have checked that the input system has no solution with
strictly positive coordinates.
Let us define another polynomial system (L-3).
f0 := x**3 + y + z + t- 1
Type: Polynomial Integer
f1 := x + y**3 + z + t -1
Type: Polynomial Integer
Type: Polynomial Integer
f3 := x + y + z + t**3 -1
Type: Polynomial Integer
|
Type: List Polynomial Integer
First compute a decomposition into regular chains (i.e. regular
triangular sets).
lts := triangSolve(lf)$pack
|
Type: List RegularChain(Integer,[x,y,z,t])
Then we compute a univariate representation.
|
Type:
List Record(
complexRoots: SparseUnivariatePolynomial Integer,
coordinates: List Polynomial Integer)
Note that this computation is made from the input system lf.
However it is possible to reuse a pre-computed regular chain as follows:
|
Type: RegularChain(Integer,[x,y,z,t])
|
Type: List Record(
complexRoots: SparseUnivariatePolynomial Integer,
coordinates: List Polynomial Integer)
Type: List List RealClosure Fraction Integer
We compute now the full set of points with real coordinates:
lr2 := realSolve(lf)$pack
Type: List List RealClosure Fraction Integer
The number of real solutions for the input system is:
Type: PositiveInteger
Another example of computation of real solutions illustrates the
LexTriangularPackage package constructor.
We concentrate now on the solutions with real (strictly) positive
coordinates:
lpr2 := positiveSolve(lf)$pack
|
Type: List List RealClosure Fraction Integer
Finally, we approximate the coordinates of this point with 20 exact digits:
[approximate(r,1/10**21)::Float for r in lpr2.1]
|
Type: List Float