-- -- Groebner bases -- R = QQ[x,y, MonomialOrder => Lex]; I = ideal(2*x^2 -y, x*y + 4); -- This computes the reduced Grobner basis of the ideal I. -- Note that the leading coefficient is not necessarily 1, though. -- However it does not output a list of polynomials. gb(I) -- This gives a single row matrix with Grobner basis elements as entries. -- (This is a natural format from a more advanced perspective.) gens(gb(I)) -- We get the entries of the matrix as a list of lists entries(gens(gb(I))) -- The 0th (i.e. first) entry is what we usually call the Groebner basis. G = (entries(gens(gb(I))))_0 -- You can get specific entries like any list G#0 G#1 -- !!! REMEMBER THE MONOMIAL ORDER !!! -- The default is grevlex! R = QQ[x,y]; -- These are the same ideal generators as above. I = ideal(2*x^2 -y, x*y + 4); -- But we get a different answer, since the monomial order is different. (entries(gens(gb(I))))_0 -- -- Here are some other examples -- -- For univariate polynomials, reduced Groebner bases are just gcds! R = QQ[x]; fs = ( x^4+x^3-x-1, x^4+x^3+3*x^2+2*x+2); I = ideal(fs); (entries(gens(gb(I))))_0 gcd(fs) -- For ideals generated by linear equations, reduced Groebner bases are just -- row reduced Echelon forms! R = QQ[x1,x2,x3,x4,x5]; fs = ( x1 + 2*x2 + 4*x3 + x5 - 2, 2*x1 + 4*x2 + x5 - 1, x1 + 2*x2 - x4 - 2); I = ideal(fs); G = (entries(gens(gb(I))))_0 -- easier to see this as follows: print ( (1/2)*G#2 ); print ( (1/8)*G#1 ); print ( (1/2)*G#0 );