10.7 Gröbner bases

This computation uses Singular behind the scenes to compute the Gröbner basis.

sage: R = PolynomialRing(QQ, 4, 'abcd', order='lp')
sage: a,b,c,d = R.gens()
sage: I = (a+b+c+d, a*b+a*d+b*c+c*d, a*b*c+a*b*d+a*c*d+b*c*d, a*b*c*d-1)*R; I
Ideal (a + b + c + d, a*b + a*d + b*c + c*d, a*b*c + a*b*d + a*c*d + b*c*d, 
a*b*c*d - 1) of Multivariate Polynomial Ring in a, b, c, d over Rational Field
sage: B = I.groebner_basis(); B
[c^2*d^6 - c^2*d^2 - d^4 + 1, 
 c^3*d^2 + c^2*d^3 - c - d, 
 b*d^4 - b + d^5 - d, 
 b*c - b*d + c^2*d^4 + c*d - 2*d^2, 
 b^2 + 2*b*d + d^2, 
 a + b + c + d]

You can work with multiple rings without having to switch back and forth like in Singular. For example,

sage: a,b,c = QQ['a,b,c'].gens()
sage: X,Y = GF(7)['X,Y'].gens()
sage: I = ideal(a, b^2, b^3+c^3)
sage: J = ideal(X^10 + Y^10)

sage: I.minimal_associated_primes ()
[Ideal (c, b, a) of Multivariate Polynomial Ring in a, b, c over Rational Field]

sage: J.minimal_associated_primes ()     # slightly random output
[Ideal (Y^4 + 3*X*Y^3 + 4*X^2*Y^2 + 4*X^3*Y + X^4) of Multivariate Polynomial 
Ring in X, Y over Finite Field of size 7, 
 Ideal (Y^4 + 4*X*Y^3 + 4*X^2*Y^2 + 3*X^3*Y + X^4) of Multivariate Polynomial 
Ring in X, Y over Finite Field of size 7, 
 Ideal (Y^2 + X^2) of Multivariate Polynomial Ring in X, Y over Finite Field 
of size 7]
All the real work is done by Singular.

Sage also includes gfan which provides other fast algorithms for computing Gröbner bases. See the section on ``Gröbner fans'' in the Sage Reference Manual for more details.

See About this document... for information on suggesting changes.