login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Adapted from Ideals, Varieties, and Algorithms Third Edition, 2007

Appendix C

Computer Algebra Systems

\S1 AXIOM

For us, the most important AXIOM commands are [normalForm]?, for doing the division algorithm, and [groebner]?, for computing a Groebner basis.

A distinctive feature of AXIOM is that every object has a specific type. In particular, this affects the way AXIOM works with monomial orders: an order is encoded in a special kind of type. For example, suppose we want to use lex order on \mathbb{Q}[x,y,z] with x > y > z. This is done using the type:

  DMP([x,y,z], FRAC INT)

(remember that AXIOM encloses a list inside brackets [...]). Here DMP stands for "Distributed Multivariate Polynomial", and FRAC INT means fractions of integers, i.e. rational numbers. Similarly, grevlex for \mathbb{Q}[x,y,z] with x>y>z means using the type:

  HDMP([x,y,z],FRAC INT)

where HDMP stands for "Homogeneous Distributed Multivariate Polynomial". At the end of the section, we will explain how to get AXIOM to work with grlex order.

To see how this works in practice, we will divide x^3 + 3y^2 by x^2 + y and x + 2xy using grevlex order with x>y. We first give the three polynomials names and declare their types:

fricas
f : HDMP([x,y], FRAC INT) := x^3+3*y^2

\label{eq1}{{x}^{3}}+{3 \ {{y}^{2}}}(1)
Type: HomogeneousDistributedMultivariatePolynomial?([x,y],Fraction(Integer))
fricas
g : HDMP([x,y], FRAC INT) := x^2+y

\label{eq2}{{x}^{2}}+ y(2)
Type: HomogeneousDistributedMultivariatePolynomial?([x,y],Fraction(Integer))
fricas
h : HDMP([x,y], FRAC INT) := x+2*x*y

\label{eq3}{2 \  x \  y}+ x(3)
Type: HomogeneousDistributedMultivariatePolynomial?([x,y],Fraction(Integer))

(Here colon : indicates a type declaration. You can save typing by giving:

  HDMP([x,y], FRAC INT)

a symbolic name.) Then the remainder is computed by the command:

fricas
normalForm(f,[g,h])

\label{eq4}{3 \ {{y}^{2}}}+{{1 \over 2}\  x}(4)
Type: HomogeneousDistributedMultivariatePolynomial?([x,y],Fraction(Integer))

The output is the remainder of f on division by g, h. In general the syntax of the command is:

  normalForm(poly, polylist)

where poly is the polynomial to be divided by the polynomials in the list polylist (assuming that everything has been declared to be of the appropriate type).

To do the same computation using lex order with x>y, first issue the command:

fricas
Lex := DMP([x,y], FRAC INT)

\label{eq5}\hbox{\axiomType{DistributedMultivariatePolynomial}\ } ([ x , y ] , \hbox{\axiomType{Fraction}\ } (\hbox{\axiomType{Integer}\ }))(5)
Type: Type

to give:

  DMP([x,y], FRAC INT)

the symbolic name Lex, and then type:

fricas
normalForm(f::Lex, [g::Lex, h::Lex])

\label{eq6}{{1 \over 2}\  x}+{3 \ {{y}^{2}}}(6)
Type: DistributedMultivariatePolynomial?([x,y],Fraction(Integer))

Here, we are using AXIOM's type conversion facility :: to convert from one type to another.

The syntax for the groebner command is:

  groebner(polylist)

This computes a Groebner basis for the ideal generated by the polynomials in polylist (of the appropriate type). The answer is reduced in the sense of Chapter 2, \S7. For example, if g, h are as above, then the command:

fricas
gb := groebner([g,h])

\label{eq7}\left[{{{x}^{2}}+ y}, \:{{x \  y}+{{1 \over 2}\  x}}, \:{{{y}^{2}}+{{1 \over 2}\  y}}\right](7)
Type: List(HomogeneousDistributedMultivariatePolynomial?([x,y],Fraction(Integer)))

computes a list (and gives it the symbolic name gb) which is a Groebner basis for the ideal <x^2+y, x+2xy >\ \subset \mathbb{Q}[x,y] with respect to grevlex for x>y. Also, if you want information about the intermediate stages of the calculation, you can include the options "redcrit" or "info" in the groebner command. For example, the command:

fricas
groebner([g,h], "redcrit")
reduced Critpair - Polynom :
2 1 y + - y 2
reduced Critpair - Polynom :
0
THE GROEBNER BASIS POLYNOMIALS

\label{eq8}\left[{{{x}^{2}}+ y}, \:{{x \  y}+{{1 \over 2}\  x}}, \:{{{y}^{2}}+{{1 \over 2}\  y}}\right](8)
Type: List(HomogeneousDistributedMultivariatePolynomial?([x,y],Fraction(Integer)))

will print out the remainders of S-polynomials (only one in this case) generated during the course of the computation. Adding the "info" option yields even more information.

AXIOM can also work with coefficients in a variety of fields besides \mathbb{Q}. this is easily done by replacing FRAC INT in the type declarations. For instance, to compute Groebner basis over the field of rational functions in polynomials with integer coefficients, one uses FRAC POLY INT. To see how this works, let us compute a Groebner basis for the ideal < vx^2+y, uxy+y^2 >\ \subset \mathbb{Q}(u,v)[x,y] using lex order with x>y. This is accomplished by the following AXIOM commands:

fricas
m : List DMP([x,y], FRAC POLY INT)
Type: Void
fricas
m := [v*x^2 + y, u*x*y + y^2]

\label{eq9}\left[{{v \ {{x}^{2}}}+ y}, \:{{u \  x \  y}+{{y}^{2}}}\right](9)
Type: List(DistributedMultivariatePolynomial?([x,y],Fraction(Polynomial(Integer))))
fricas
groebner(m)

\label{eq10}\left[{{{x}^{2}}+{{1 \over v}\  y}}, \:{{x \  y}+{{1 \over u}\ {{y}^{2}}}}, \:{{{y}^{3}}+{{{{u}^{2}}\over v}\ {{y}^{2}}}}\right](10)
Type: List(DistributedMultivariatePolynomial?([x,y],Fraction(Polynomial(Integer))))

Notice that this illustrates another method for declaring the type of polynomials used in a Grobner basis computation.

Other fields are just as easy: one uses FRAC COMPLEX INT for the field of Gaussian rational numbers \mathbb{Q}(i) = \{ a+bi : a,b \in \mathbb{Q} \} (note that AXIOM writes i=\sqrt{-1} as %i) and PrimeField(p) for a finite field with p elements (where p is a prime). It is also possible to compute Groebner bases over arbitrary finite fields. AXIOM's method of working with finite fields is explained in Section 8.11 of JENKS and SUTOR (1992) (See: Axiom Documentation). The ability to "insert" the field you want to compute Groebner bases over is a good illustration of the power of AXIOM.

Besides working with lists of polynomials, AXIOM also allows the user to declare a list of polynomials to be an ideal. The syntax of the ideal command is:

  ideal polylist

where polylist is a list of polynomials of the appropriate type. This is useful because AXIOM has a number of commands which apply to ideals (PolynomialIdeals?):

  • intersect, which computes the intersection of a list of ideals.
  • zeroDim?, which determines (using the methods of Chapter 5, \S3) if the equations have finitely many solutions over an algebraically closed field.
  • dimension, which computes the dimension of the variety defined by an ideal.
  • prime?, which determines whether an ideal is prime.
  • radical, which computes the radical of an ideal.
  • primaryDecomp, which computes the primary decomposition of an ideal.

Examples of how to use these and other related commands can be found in Section 8.12 of JENKS and SUTOR (1992). We should also mention that there are the commands leadingMonomial and leadingCoefficient for extracting the leading term and coefficient of a polynomial.

All of the commands described so far require that you declare in advance the type of polynomial you'll be using. However, if you only need Groebner bases in lex or grevlex order with rational coefficients, then a simpler approach is to use the AXIOM commands lexGroebner and totalGroebner. For example, the command:

fricas
lexGroebner([2*x^2+y,2*y^2+x], [x,y])

\label{eq11}\left[{{2 \ {{y}^{2}}}+ x}, \:{{8 \ {{y}^{4}}}+ y}\right](11)
Type: List(Polynomial(Integer))

computes a Greobner basis (reduced up to constants) for the ideal < 2x^2+y,2y^2+x >\ \subset \mathbb{Q}[x,y] using lex order with x>y. Notice that we didn't have to declare the type of the polynomials in advance - lexGroebner takes care of this. To do the same computation using grevlex, simply replace lexGroebner with totalGoebner.

We will end this section by explaining how to get AXIOM to work with grlex order. All of the raw material need is present in AXIOM, though it takes a little work to put it together. For concreteness, suppose we want grlex order on \mathbb{Q}[x,y] with x>y$. Then issue the commands:

fricas
)set expose add constructor GDMP
GeneralDistributedMultivariatePolynomial is now explicitly exposed in frame initial
fricas
)set expose add constructor ODP
OrderedDirectProduct is now explicitly exposed in frame initial Grlex := GDMP([x,y], FRAC INT, ODP(2,NNI,totalLex$ORDFUNS(2,NNI)));
Type: Type

The basic idea here is that GDMP stands for "Generalized Distributed Multivariate Polynomial", this can be used to create an AXIOM type for any monomial order, and totalLex is the function which orders exponent vectors using grlex. By declaring polynomials to be of type Grlex, you can now compute Groebner bases using grlex with x>y.

fricas
groebner([g::Grlex, h::Grlex])
Cannot convert the value from type HomogeneousDistributedMultivariatePolynomial([x,y],Fraction( Integer)) to GeneralDistributedMultivariatePolynomial([x,y], Fraction(Integer),OrderedDirectProduct(2,NonNegativeInteger, theMap(ORDFUNS;totalLex;2VB;2,303))) .

We should caution that type conversion doesn't work between Grlex and the monomial orders created by DMP and HDMP, though it is possible to write type conversion routines.

fricas
j : Grlex := x^2+y

\label{eq12}{{x}^{2}}+ y(12)
Type: GeneralDistributedMultivariatePolynomial?([x,y],Fraction(Integer),OrderedDirectProduct?(2,NonNegativeInteger?,theMap(ORDFUNS;totalLex;2VB;2,303)))
fricas
k : Grlex := x+2*x*y

\label{eq13}{2 \  x \  y}+ x(13)
Type: GeneralDistributedMultivariatePolynomial?([x,y],Fraction(Integer),OrderedDirectProduct?(2,NonNegativeInteger?,theMap(ORDFUNS;totalLex;2VB;2,303)))
fricas
groebner([j, k])

\label{eq14}\left[{{{x}^{2}}+ y}, \:{{x \  y}+{{1 \over 2}\  x}}, \:{{{y}^{2}}+{{1 \over 2}\  y}}\right](14)
Type: List(GeneralDistributedMultivariatePolynomial?([x,y],Fraction(Integer),OrderedDirectProduct?(2,NonNegativeInteger?,theMap(ORDFUNS;totalLex;2VB;2,303))))

Using the AXIOM concept of a package, one could write a package which knows all of the monomial orders mentioned in the exercises to Chapter 2, \S4, along with commands to convert one type to the other.

Parameters and Variables --Bill Page, Wed, 19 Feb 2014 00:05:33 +0000 reply
When constructing multivariate polynomials with symbolic parameters variable names (generators) must be specified. Unspecified names default to parameters. The choice of variables and parameters will affect the computation of a basis.
fricas
param := FRAC POLY INT

\label{eq15}\hbox{\axiomType{Fraction}\ } (\hbox{\axiomType{Polynomial}\ } (\hbox{\axiomType{Integer}\ }))(15)
Type: Type
fricas
--vars := [ca,cb,sa,sb,x,y,r1,r2,r3,lab,lac]
--vars := [ca,sa,x,y]
vars := [ca,cb,sa,sb,x,y]

\label{eq16}\left[ ca , \: cb , \: sa , \: sb , \: x , \: y \right](16)
Type: List(OrderedVariableList([ca,cb,sa,sb,x,y]))
fricas
mm:List DMP(vars,param) := [x^2+y^2-r1^2,(x+lab*ca)^2+(y+lab*sa)^2-r2^2,(x+lac*(ca*cb-sa*sb))^2+(y+lac*(sa*cb+ca*sb))^2-r3^2,ca^2+sa^2-1]

\label{eq17}\begin{array}{@{}l}
\displaystyle
\left[{{{x}^{2}}+{{y}^{2}}-{{r 1}^{2}}}, \: \right.
\
\
\displaystyle
\left.{{{{lab}^{2}}\ {{ca}^{2}}}+{2 \  lab \  ca \  x}+{{{lab}^{2}}\ {{sa}^{2}}}+{2 \  lab \  sa \  y}+{{x}^{2}}+{{y}^{2}}-{{r 2}^{2}}}, \right.
\
\
\displaystyle
\left.\: \right.
\
\
\displaystyle
\left.{
\begin{array}{@{}l}
\displaystyle
{{{lac}^{2}}\ {{ca}^{2}}\ {{cb}^{2}}}+{{{lac}^{2}}\ {{ca}^{2}}\ {{sb}^{2}}}+{2 \  lac \  ca \  cb \  x}+{2 \  lac \  ca \  sb \  y}+ 
\
\
\displaystyle
{{{lac}^{2}}\ {{cb}^{2}}\ {{sa}^{2}}}+{2 \  lac \  cb \  sa \  y}+{{{lac}^{2}}\ {{sa}^{2}}\ {{sb}^{2}}}-{2 \  lac \  sa \  sb \  x}+ 
\
\
\displaystyle
{{x}^{2}}+{{y}^{2}}-{{r 3}^{2}}
(17)
Type: List(DistributedMultivariatePolynomial?([ca,cb,sa,sb,x,y],Fraction(Polynomial(Integer))))
fricas
b := groebner(mm); #b

\label{eq18}12(18)
Type: PositiveInteger?
fricas
for i in b repeat
  outputAsTex i

\label{eq19}\begin{array}{@{}l}
\displaystyle
{{ca}^{2}}+{{{{{r 2}^{2}}-{{r 1}^{2}}-{{lab}^{2}}}\over{lab \ {{r 1}^{2}}}}\  sa \  y}-{{1 \over{{r 1}^{2}}}\ {{y}^{2}}}+ 
\
\
\displaystyle
{{-{{r 2}^{4}}+{{\left({2 \ {{r 1}^{2}}}+{2 \ {{lab}^{2}}}\right)}\ {{r 2}^{2}}}-{{r 1}^{4}}-{2 \ {{lab}^{2}}\ {{r 1}^{2}}}-{{lab}^{4}}}\over{4 \ {{lab}^{2}}\ {{r 1}^{2}}}}
(19)

\label{eq20}\begin{array}{@{}l}
\displaystyle
{ca \ {{cb}^{2}}}+{{{{{r 2}^{2}}-{{r 1}^{2}}-{{lab}^{2}}}\over{lab \  lac}}\  ca \  cb}+{{{-{{r 3}^{2}}+{{r 1}^{2}}}\over{{lac}^{2}}}\  ca}- 
\
\
\displaystyle
{{lac \over{2 \ {{r 1}^{2}}}}\ {{cb}^{2}}\  sb \  y}+{{{-{{r 2}^{2}}+{{r 1}^{2}}+{{lab}^{2}}}\over{2 \  lab \ {{r 1}^{2}}}}\  cb \  sb \  y}+ 
\
\
\displaystyle
{{{-{{r 2}^{2}}+{{r 1}^{2}}+{{lab}^{2}}}\over{lab \  lac}}\  sa \  sb}-{{lac \over{2 \ {{r 1}^{2}}}}\ {{sb}^{3}}\  y}+ 
\
\
\displaystyle
{{{{{r 2}^{2}}-{{r 1}^{2}}-{{lab}^{2}}}\over{2 \  lab \ {{r 1}^{2}}}}\ {{sb}^{2}}\  x}+{{{{{r 3}^{2}}+{3 \ {{r 1}^{2}}}}\over{2 \  lac \ {{r 1}^{2}}}}\  sb \  y}
(20)

\label{eq21}\begin{array}{@{}l}
\displaystyle
{ca \  sa}+{{{-{{r 2}^{2}}+{{r 1}^{2}}+{{lab}^{2}}}\over{2 \  lab \ {{r 1}^{2}}}}\  ca \  y}+{{{-{{r 2}^{2}}+{{r 1}^{2}}+{{lab}^{2}}}\over{2 \  lab \ {{r 1}^{2}}}}\  sa \  x}+ 
\
\
\displaystyle
{{1 \over{{r 1}^{2}}}\  x \  y}
(21)

\label{eq22}\begin{array}{@{}l}
\displaystyle
{ca \  sb}+{{lac \over{2 \ {{r 1}^{2}}}}\ {{cb}^{2}}\  y}+{{{{{r 2}^{2}}-{{r 1}^{2}}-{{lab}^{2}}}\over{2 \  lab \ {{r 1}^{2}}}}\  cb \  y}+{{lac \over{2 \ {{r 1}^{2}}}}\ {{sb}^{2}}\  y}+ 
\
\
\displaystyle
{{{-{{r 2}^{2}}+{{r 1}^{2}}+{{lab}^{2}}}\over{2 \  lab \ {{r 1}^{2}}}}\  sb \  x}+{{{-{{r 3}^{2}}+{{r 1}^{2}}}\over{2 \  lac \ {{r 1}^{2}}}}\  y}
(22)

\label{eq23}{ca \  x}+{sa \  y}+{{-{{r 2}^{2}}+{{r 1}^{2}}+{{lab}^{2}}}\over{2 \  lab}}(23)

\label{eq24}{ca \ {{y}^{2}}}-{{{r 1}^{2}}\  ca}-{sa \  x \  y}+{{{{{r 2}^{2}}-{{r 1}^{2}}-{{lab}^{2}}}\over{2 \  lab}}\  x}(24)

\label{eq25}\begin{array}{@{}l}
\displaystyle
{{cb}^{4}}+{{{{2 \ {{r 2}^{2}}}-{2 \ {{r 1}^{2}}}-{2 \ {{lab}^{2}}}}\over{lab \  lac}}\ {{cb}^{3}}}+{2 \ {{cb}^{2}}\ {{sb}^{2}}}+ 
\
\
\displaystyle
{{{\left(
\begin{array}{@{}l}
\displaystyle
-{2 \ {{lab}^{2}}\ {{r 3}^{2}}}+{{r 2}^{4}}+{{\left(-{2 \ {{r 1}^{2}}}-{2 \ {{lab}^{2}}}\right)}\ {{r 2}^{2}}}+ 
\
\
\displaystyle
{{r 1}^{4}}+{4 \ {{lab}^{2}}\ {{r 1}^{2}}}+{{lab}^{4}}
(25)

\label{eq26}\begin{array}{@{}l}
\displaystyle
{{{cb}^{2}}\  sa}+{{{-{{r 2}^{2}}+{{r 1}^{2}}+{{lab}^{2}}}\over{2 \  lab \ {{r 1}^{2}}}}\ {{cb}^{2}}\  y}+{{{{{r 2}^{2}}-{{r 1}^{2}}-{{lab}^{2}}}\over{lab \  lac}}\  cb \  sa}+ 
\
\
\displaystyle
{{{-{{r 2}^{4}}+{{\left({2 \ {{r 1}^{2}}}+{2 \ {{lab}^{2}}}\right)}\ {{r 2}^{2}}}-{{r 1}^{4}}-{2 \ {{lab}^{2}}\ {{r 1}^{2}}}-{{lab}^{4}}}\over{2 \ {{lab}^{2}}\  lac \ {{r 1}^{2}}}}\  cb \  y}+ 
\
\
\displaystyle
{sa \ {{sb}^{2}}}+{{{-{{r 3}^{2}}+{{r 1}^{2}}}\over{{lac}^{2}}}\  sa}+{{{-{{r 2}^{2}}+{{r 1}^{2}}+{{lab}^{2}}}\over{2 \  lab \ {{r 1}^{2}}}}\ {{sb}^{2}}\  y}+ 
\
\
\displaystyle
{{{{{r 2}^{4}}+{{\left(-{2 \ {{r 1}^{2}}}-{2 \ {{lab}^{2}}}\right)}\ {{r 2}^{2}}}+{{r 1}^{4}}-{2 \ {{lab}^{2}}\ {{r 1}^{2}}}+{{lab}^{4}}}\over{2 \ {{lab}^{2}}\  lac \ {{r 1}^{2}}}}\  sb \  x}+ 
\
\
\displaystyle
{{{{{\left({{r 2}^{2}}-{{r 1}^{2}}-{{lab}^{2}}\right)}\ {{r 3}^{2}}}-{{{r 1}^{2}}\ {{r 2}^{2}}}+{{r 1}^{4}}+{{{lab}^{2}}\ {{r 1}^{2}}}}\over{2 \  lab \ {{lac}^{2}}\ {{r 1}^{2}}}}\  y}
(26)

\label{eq27}\begin{array}{@{}l}
\displaystyle
{{{cb}^{2}}\  x}+{{{{{r 2}^{2}}-{{r 1}^{2}}-{{lab}^{2}}}\over{lab \  lac}}\  cb \  x}-{{{2 \ {{r 1}^{2}}}\over lac}\  sa \  sb}+{{{sb}^{2}}\  x}+ 
\
\
\displaystyle
{{{{{r 2}^{2}}-{{r 1}^{2}}-{{lab}^{2}}}\over{lab \  lac}}\  sb \  y}+{{{-{{r 3}^{2}}+{{r 1}^{2}}}\over{{lac}^{2}}}\  x}
(27)

\label{eq28}\begin{array}{@{}l}
\displaystyle
{{{cb}^{2}}\ {{y}^{2}}}-{{{r 1}^{2}}\ {{cb}^{2}}}+{{{{{r 2}^{2}}-{{r 1}^{2}}-{{lab}^{2}}}\over{lab \  lac}}\  cb \ {{y}^{2}}}+ 
\
\
\displaystyle
{{{-{{{r 1}^{2}}\ {{r 2}^{2}}}+{{r 1}^{4}}+{{{lab}^{2}}\ {{r 1}^{2}}}}\over{lab \  lac}}\  cb}+{{{2 \ {{r 1}^{2}}}\over lac}\  sa \  sb \  x}+{{{sb}^{2}}\ {{y}^{2}}}- 
\
\
\displaystyle
{{{r 1}^{2}}\ {{sb}^{2}}}+{{{-{{r 2}^{2}}+{{r 1}^{2}}+{{lab}^{2}}}\over{lab \  lac}}\  sb \  x \  y}+{{{-{{r 3}^{2}}+{{r 1}^{2}}}\over{{lac}^{2}}}\ {{y}^{2}}}+ 
\
\
\displaystyle
{{{{{r 1}^{2}}\ {{r 3}^{2}}}-{{r 1}^{4}}}\over{{lac}^{2}}}
(28)

\label{eq29}\begin{array}{@{}l}
\displaystyle
{{sa}^{2}}+{{{-{{r 2}^{2}}+{{r 1}^{2}}+{{lab}^{2}}}\over{lab \ {{r 1}^{2}}}}\  sa \  y}+{{1 \over{{r 1}^{2}}}\ {{y}^{2}}}+ 
\
\
\displaystyle
{{{{r 2}^{4}}+{{\left(-{2 \ {{r 1}^{2}}}-{2 \ {{lab}^{2}}}\right)}\ {{r 2}^{2}}}+{{r 1}^{4}}-{2 \ {{lab}^{2}}\ {{r 1}^{2}}}+{{lab}^{4}}}\over{4 \ {{lab}^{2}}\ {{r 1}^{2}}}}
(29)

\label{eq30}{{x}^{2}}+{{y}^{2}}-{{r 1}^{2}}(30)
Type: Void




  Subject:   Be Bold !!
  ( 15 subscribers )  
Please rate this page: