Overview of the Groebner Package
Calling Sequence
Description
List of Groebner Package Commands
Examples
Groebner:-command(arguments)
command(arguments)
This page describes the most common use of the Groebner package, namely calculations of Groebner bases and related operations for ideals in (commutative) polynomial rings. The Groebner package is actually much more general and can handle polynomials in skew polynomial rings (see Groebner/details) and modules over (commutative or skew) polynomial rings (see Groebner Bases for Modules).
Each command in the Groebner package can be accessed by using either the long form or the short form of the command name in the command calling sequence.
The long form, Groebner:-command, is always available. The short form can be used after loading the package.
The following is a list of available commands.
Basis
FGLM
HilbertDimension
HilbertPolynomial
HilbertSeries
Homogenize
InitialForm
InterReduce
IsBasis
IsProper
IsZeroDimensional
LeadingCoefficient
LeadingMonomial
LeadingTerm
MatrixOrder
MaximalIndependentSet
MonomialOrder
MultiplicationMatrix
MultivariateCyclicVector
NormalForm
NormalSet
RationalUnivariateRepresentation
Reduce
RememberBasis
Solve
SPolynomial
SuggestVariableOrder
Support
TestOrder
ToricIdealBasis
TrailingTerm
UnivariatePolynomial
Walk
WeightedDegree
To display the help page for a particular Groebner command, see Getting Help with a Command in a Package.
Many predefined monomial orderings are available for use with Groebner commands. This includes total degree, lexicographic, elimination, and matrix-defined orderings. See the page on monomial orders.
The TestOrder command checks if two monomials are in a given monomial ordering and can be used to sort a list of monomials by a given monomial ordering.
The commands LeadingCoefficient, LeadingMonomial, and LeadingTerm compute the leading coefficient, leading monomial, and leading term of a polynomial respectively.
The NormalForm command computes the normal form of a polynomial modulo an ideal. The command Reduce returns the pseudo-remainder of a polynomial in the division by a list of polynomials. The InterReduce command inter-reduces a list of polynomials. Both the NormalForm and Reduce commands are usually used after a (reduced) Groebner basis has been computed.
The Basis command computes a (reduced) Groebner bases of a polynomial ideal. The RememberBasis command makes a Groebner basis known to the system without performing any computation.
The IsBasis command tests if a basis is a Groebner basis for a given monomial ordering.
The Solve command preprocesses a set of generators in view of solving.
The SPolynomial command computes the S-polynomial of two polynomials.
The UnivariatePolynomial command finds univariate polynomials of least degree in a polynomial ideal.
The commands IsZeroDimensional and IsProper decide whether an ideal has finitely many solutions, or at least one solution, respectively.
The commands HilbertDimension, HilbertPolynomial, and HilbertSeries compute the Hilbert dimension, Hilbert polynomial, and Hilbert series of an ideal, respectively.
A typical test of membership in an ideal is:
1. Perform a Groebner basis computation to find a Groebner basis of the ideal (usually with tdeg);
2. Call Groebner:-NormalForm to test whether it returns zero.
A typical use of Groebner bases for elimination is:
1. Compute a Groebner basis with respect to an elimination monomial order (with the lexdeg syntax);
2. Select those polynomials in which the indeterminate to be eliminated has disappeared.
When relevant, most commands of the Groebner package accept algebraic numbers and algebraic functions denoted by I, radicals, or RootOfs in their the inputs. Exceptions are MultiplicationMatrix, NormalSet, and Solve. Also when relevant, they accept PolynomialIdeal data structures in their input.
You can use the Groebner package in conjunction with the PolynomialIdeals package.
Note: Both packages have the following exports of the same name and almost identical functionality: HilbertDimension, IsProper, IsZeroDimensional, and UnivariatePolynomial. After loading both packages using with, these names refer to the corresponding exports of the most recently loaded package, but you can still access the exports with the same name in the other package using the long form, that is, by prepending the package name.
with⁡Groebner
Basis,FGLM,HilbertDimension,HilbertPolynomial,HilbertSeries,Homogenize,InitialForm,InterReduce,IsBasis,IsProper,IsZeroDimensional,LeadingCoefficient,LeadingMonomial,LeadingTerm,MatrixOrder,MaximalIndependentSet,MonomialOrder,MultiplicationMatrix,MultivariateCyclicVector,NormalForm,NormalSet,RationalUnivariateRepresentation,Reduce,RememberBasis,SPolynomial,Solve,SuggestVariableOrder,Support,TestOrder,ToricIdealBasis,TrailingTerm,UnivariatePolynomial,Walk,WeightedDegree
Groebner Bases and Ideal Membership Testing
B≔x+y+z,x⁢y+y⁢z+z⁢x,x⁢y⁢z−1
B≔x+y+z,x⁢y+z⁢x+y⁢z,x⁢y⁢z−1
First we compute a Groebner basis G for the ideal generated by B using the graded reverse lexicographical monomial ordering tdeg with x>y>z.
G≔Basis⁡B,tdeg⁡x,y,z
G≔x+y+z,y2+y⁢z+z2,z3−1
Thus z3−1 is in the ideal generated by B. Notice that B is symmetric in the variables and hence x3−1 and y3−1 must also be in the ideal. We test this as follows.
NormalForm⁡x3−1,G,tdeg⁡x,y,z
0
NormalForm⁡x2,G,tdeg⁡x,y,z
y⁢z
Thus, x3−1 is in the ideal generated by B while x2 is not. We show that B is not a Groebner basis and G is.
IsBasis⁡B,tdeg⁡x,y,z
false
IsBasis⁡G,tdeg⁡x,y,z
true
For our second example we triangularize a polynomial system {x2+y2=1, x+y+1=0} by computing a Groebner basis using the pure lexicographical monomial ordering plex with x>y.
B≔x2+y2−1,x+y+1
G≔Basis⁡B,plex⁡x,y
G≔y2+y,x+y+1
Note Maple does not automatically order the terms of polynomials in the monomial ordering being used. Here are the leading monomials of the polynomials in G.
LeadingMonomial⁡G,plex⁡x,y
y2,x
From the triangular form of the Groebner basis, it is easy to see how to solve the system. Note, the solutions of the original system are the same as the zeros of the polynomials in the Groebner basis. This is true for any monomial ordering.
factor⁡G
y⁢y+1,x+y+1
solve⁡G,x,y
x=−1,y=0,x=0,y=−1
Monomial Orderings
Besides the tdeg monomial ordering for "fast" normal form computation and the plex monomial ordering for "slow" triangularization, lexdeg orderings are available for more efficient elimination. For the purpose of generality, the Groebner package implements weighted monomial orderings (wdeg) and matrix-defined monomial orderings. Products of orders and user-defined orderings are also available.
For our first example, we find the implicit equation x2+y2−1 of a circle from its rational parametrization by eliminating the parameter t.
param≔x=1−t21+t2,y=2⁢t1+t2
param≔x=−t2+1t2+1,y=2⁢tt2+1
First we convert to polynomials and clear the fractions.
B≔map⁡eq↦numer⁡lhs⁡eq−rhs⁡eq,param
B≔t2⁢y−2⁢t+y,t2⁢x+t2+x−1
G≔Basis⁡B,lexdeg⁡t,x,y
G≔x2+y2−1,y⁢t+x−1,x⁢t+t−y
remove⁡has,G,t
x2+y2−1
As a second example, here is a calculation that is performed far faster by using lexdeg than by using plex. Assume that we want to find the extrema of
φ≔x3+2⁢x⁢y⁢z−z2
on the sphere
const≔x2+y2+z2−1
Using the method of Lagrange multipliers, we compute
G≔const,seq⁡diff⁡φ,v−diff⁡const,v⁢t,v=x,y,z
G≔−2⁢y⁢t+2⁢z⁢x,−2⁢z⁢t+2⁢x⁢y−2⁢z,−2⁢x⁢t+3⁢x2+2⁢y⁢z,x2+y2+z2−1
and we eliminate the multiplier t by the use of an appropriate monomial order
GB≔Basis⁡G,lexdeg⁡t,x,y,z
GB≔x2+y2+z2−1,17⁢y⁢z2−13⁢z3−x⁢y+17⁢z⁢x+13⁢z,17⁢y2⁢z+7⁢z3−6⁢x⁢y−7⁢z,17⁢y3+11⁢z3−7⁢x⁢y−17⁢z⁢x−17⁢y−11⁢z,x⁢y2−z2⁢x−y⁢z,48⁢z4−63⁢x⁢y⁢z−34⁢z2⁢x−34⁢y⁢z−48⁢z2,408⁢x⁢z3+233⁢z3+65⁢x⁢y−408⁢z⁢x−233⁢z,−6⁢x⁢y⁢z+6⁢z2⁢x+3⁢y⁢z+2⁢z2+2⁢t−3⁢x
remove⁡has,GB,t
x2+y2+z2−1,17⁢y⁢z2−13⁢z3−x⁢y+17⁢z⁢x+13⁢z,17⁢y2⁢z+7⁢z3−6⁢x⁢y−7⁢z,17⁢y3+11⁢z3−7⁢x⁢y−17⁢z⁢x−17⁢y−11⁢z,x⁢y2−z2⁢x−y⁢z,48⁢z4−63⁢x⁢y⁢z−34⁢z2⁢x−34⁢y⁢z−48⁢z2,408⁢x⁢z3+233⁢z3+65⁢x⁢y−408⁢z⁢x−233⁢z
In the general case, we would have to compute numerical estimates and substitute into φ. Here, we can go further and compute all the possible values for z by the elimination of x and y.
GB2≔Basis⁡,lexdeg⁡x,y,z
GB2≔1152⁢z7−1763⁢z5+655⁢z3−44⁢z,−1152⁢z6+118⁢z3⁢y+1605⁢z4−118⁢y⁢z−453⁢z2,−1152⁢z5+3835⁢y⁢z2−1404⁢z3+3835⁢z⁢x+2556⁢z,−6912⁢z5+3835⁢y2⁢z+10751⁢z3−3839⁢z,−19584⁢z5+25987⁢z3+3835⁢x⁢y−6403⁢z,x2+y2+z2−1,−9216⁢z5+3835⁢y3+3835⁢y⁢z2+11778⁢z3−3835⁢y−2562⁢z
op⁡remove⁡has,GB2,x,y
1152⁢z7−1763⁢z5+655⁢z3−44⁢z
sol_z≔solve⁡,z
sol_z≔0,1,−1,23,−23,2216,−2216
Substituting into the system yields the possible extremal points.
seq⁡op@map⁡`union`,solve⁡eval⁡GB2,z=i,x,y,z=i,i=sol_z
x=1,y=0,z=0,x=−1,y=0,z=0,x=0,y=1,z=0,x=0,y=−1,z=0,x=0,y=0,z=1,x=0,y=0,z=−1,x=−23,y=13,z=23,x=−23,y=−13,z=−23,x=−38,y=−3⁢2216,z=2216,x=−38,y=3⁢2216,z=−2216
Finally, we get the minimum and maximum values.
min⁡map2⁡eval,φ,,max⁡map2⁡eval,φ,
−2827,1
Similar calculations using plex require a significantly longer amount of time.
Ideal Invariants
The dimension of a variety (zero for isolated points, one for lines, two for planes) is the Hilbert dimension of the corresponding annihilating ideal. The Groebner package allows one to compute this Hilbert dimension, together with the Hilbert polynomial and the Hilbert series.
As a first example, here is a zero-dimensional ideal, corresponding to finitely many points in the variety.
G≔3⁢y2−8⁢z3,x2−2⁢z⁢x+5,3⁢y3+8⁢x⁢y2:
HilbertDimension⁡G,tdeg⁡y,x,z
HilbertSeries⁡G,tdeg⁡y,x,z,s
s5+3⁢s4+5⁢s3+5⁢s2+3⁢s+1
eval⁡,s=1
18
HilbertPolynomial⁡G,tdeg⁡y,x,z,s
As another example, here is an ideal of positive dimension.
G≔x3⁢y2+3⁢x2⁢y2+y3+1:
HilbertDimension⁡G,tdeg⁡x,y
1
HilbertSeries⁡G,tdeg⁡x,y,s
−s4+s3+s2+s+1−1+s
series⁡,s,10
1+2⁢s+3⁢s2+4⁢s3+5⁢s4+5⁢s5+5⁢s6+5⁢s7+5⁢s8+5⁢s9+O⁡s10
HilbertPolynomial⁡G,tdeg⁡y,x,s
5
Ground Fields
The Groebner package supports transcendental and algebraic extensions of the field of rational numbers and finite fields. This includes algebraic number fields. Here is a sample computation with complex numbers in ℚⅈ,2x,y.
G≔x2+y2−I,sqrt⁡2⁢y+sqrt⁡2⁢x−sqrt⁡2−1
G≔x2+y2−I,2⁢y+2⁢x−2−1
GB≔Basis⁡G,tdeg⁡x,y
GB≔2⁢x+2⁢y−3⁢2,−6⁢2⁢y+4⁢y2+9−2⁢I
Computations with modular integers are supported as well, by means of an option.
G≔x2−2⁢x⁢z+5,x⁢y2+y⁢z3,3⁢y2−8⁢z3:
Gmod5
x2+3⁢z⁢x,z3⁢y+x⁢y2,2⁢z3+3⁢y2
Basis⁡G,plex⁡x,y,z,characteristic=5
z8+z7,3⁢z6+y⁢z4,4⁢z3+y2,x⁢z3+z3⁢y,x2+3⁢z⁢x
Standard Bases
As another example, the Groebner package allows for the computation of standard bases. We define the leading monomial of a polynomial as its minimum monomial instead of its maximum monomial by using a plex_min monomial order rather than a plex monomial order.
L≔1+x+y+z+x2+y2+z2
L≔x2+y2+z2+x+y+z+1
LeadingMonomial⁡L,plex⁡x,y,z
x2
LeadingMonomial⁡L,plex_min⁡x,y,z
Then Groebner bases can be computed for homogeneous ideals. Here is an example in ℚ⁢x,y,z,w.
G≔y⁢w2−z3,x⁢w3−z4
Compare the usual Groebner basis
Basis⁡G,plex⁡w,x,y,z
x2⁢z6−y3⁢z5,w⁢y2⁢z4−x⁢z6,w⁢x⁢z3−y⁢z4,y⁢w2−z3,x⁢w3−z4
which allows for divisions by decreasing powers:
Reduce⁡w5⁢x3⁢y2⁢z,,plex⁡w,x,y,z
y4⁢z7
and the standard basis
Basis⁡G,plex_min⁡w,x,y,z
−w4⁢x2⁢z+w4⁢y3,−w4⁢y2+w3⁢x⁢z2,−x⁢w3+w2⁢y⁢z,−y⁢w2+z3
which allows for divisions by increasing powers:
Reduce⁡w5⁢x3⁢y2⁢z,,plex_min⁡w,x,y,z
w6⁢x4⁢y
See Also
Groebner/details
Groebner:-Basis
PolynomialIdeals
PolynomialIdeals Example Worksheet
PolynomialIdeals:-PolynomialIdeal
RegularChains
Terminology Used in Groebner
UsingPackages
with
Download Help Document