For a definition of Gröbner basis, see
what is a Groebner basis?.
A first Gröbner basis
Weight vectors and non-strict monomial orders
The monomial order may be given by a weight vector (see
monomial orderings),
i1 : R = QQ[a..f,MonomialOrder=>Weights=>{1,1,1,1,0,0}]
o1 = R
o1 : PolynomialRing
|
i2 : I = ideal(a*b*c-d*e*f,a*c*e-b*d*f,a*d*f-b*c*e)
o2 = ideal (a*b*c - d*e*f, a*c*e - b*d*f, - b*c*e + a*d*f)
o2 : Ideal of R
|
i3 : gens gb I
o3 = | bce-adf ace-bdf abc-def b2df-de2f a2df-de2f c2de3f-d3ef3 abd2f2-cde3f
------------------------------------------------------------------------
|
1 7
o3 : Matrix R <-- R
|
i4 : leadTerm I
2 2 2 3 2 2
o4 = ideal (b*c*e, a*c*e, a*b*c, b d*f, a d*f, c d*e f, a*b*d f )
o4 : Ideal of R
|
The monomial order used here is: first consider the dot product of the weight vector and the exponent vectors. The larger determines the lead term. If these dot products are the same, then ties are broken with graded reverse lexicographic order. Sometimes, one wants the lead term ideal with respect to the weight vector itself. This ideal, often not a monomial ideal, may be obtained by selecting only the first part of the monomial order while finding the lead term matrix:
i5 : leadTerm(1,I)
2 2 2 3
o5 = ideal (b*c*e - a*d*f, a*c*e - b*d*f, a*b*c, b d*f, a d*f, c d*e f -
------------------------------------------------------------------------
3 3 2 2
d e*f , a*b*d f )
o5 : Ideal of R
|
Gröbner basis over the integers
A strong Gröbner basis of an ideal $I \subset{} ZZ[x_1,...,x_n]$ is a set $G$ of elements of $I$ such that, if $cm$ is any lead term of $I$ ($c$ a coefficient, and $m$ a monomial), then there is an element of $G$ whose lead term divides $cm$.
Macaulay2 computes such strong Gröbner bases over ZZ.
i6 : R = ZZ[x,y]
o6 = R
o6 : PolynomialRing
|
i7 : F = y^2-(x^3+3*x+5)
3 2
o7 = - x + y - 3x - 5
o7 : R
|
i8 : I = ideal(F, diff(x,F), diff(y,F))
3 2 2
o8 = ideal (- x + y - 3x - 5, - 3x - 3, 2y)
o8 : Ideal of R
|
i9 : gens gb I
o9 = | 174 2y 6x-72 y2+87 3x2+3 x2y+y x3+3x-82 |
1 7
o9 : Matrix R <-- R
|
i10 : leadTerm I
2 2 2 3
o10 = ideal (174, 2y, 6x, y , 3x , x y, x )
o10 : Ideal of R
|
i11 : factor 174
o11 = 2*3*29
o11 : Expression of class Product
|
This elliptic curve is smooth for all primes $p \neq 2, 3, 29$.
Gröbner basis over a quotient ring
The lead terms of the Gröbner basis generate all possible lead terms modulo the lead terms of the quotient ideal.
i12 : R = QQ[a..d]/(a^2+b^2+c^2+d^2-1)
o12 = R
o12 : QuotientRing
|
i13 : I = ideal(a*b*c*d)
o13 = ideal(a*b*c*d)
o13 : Ideal of R
|
i14 : gens gb I
o14 = | abcd b3cd+bc3d+bcd3-bcd |
1 2
o14 : Matrix R <-- R
|
A Gröbner basis over a skew-commutative ring
The lead terms of the Gröbner basis generate all possible lead terms, as in the commutative case. Essentially the same algorithm is applicable in this case.
i15 : R = QQ[a..d,SkewCommutative=>true]
o15 = R
o15 : PolynomialRing, 4 skew commutative variable(s)
|
i16 : I = ideal(a*b-c*d)
o16 = ideal(a*b - c*d)
o16 : Ideal of R
|
i17 : gens gb I
o17 = | ab-cd bcd acd |
1 3
o17 : Matrix R <-- R
|
Gröbner basis over polynomial rings over polynomial rings
For such rings, we may imagine a polynomial ring over a base field, or over the integers, possibly modulo some ideal. The resulting Gröbner basis is this one. The monomial order is a product order, with the variables in the outermost polynomial ring the most expensive.
i18 : A = QQ[s,c]/(s^2+c^2-1)
o18 = A
o18 : QuotientRing
|
i19 : B = A[x,y,z]
o19 = B
o19 : PolynomialRing
|
i20 : I = ideal(c*x^2, s*y^2, c*y-s*x)
2 2
o20 = ideal (c*x , s*y , - s*x + c*y)
o20 : Ideal of B
|
i21 : gens gb I
o21 = | sx-cy (c2-1)x+scy y2 xy x2 |
1 5
o21 : Matrix B <-- B
|
i22 : leadTerm oo
o22 = | sx c2x y2 xy x2 |
1 5
o22 : Matrix B <-- B
|
A Gröbner basis of a submodule