-- This is code related to lectures from Jan 25
-- Math 615, Winter 2013
-- By: Daniel Erman
S = QQ[x_0..x_3]
x_0*x_2 > x_1^2
viewHelp GRevLex
R = QQ[x_0..x_3, MonomialOrder => Lex]
x_0*x_2 > x_1^2
viewHelp MonomialOrder
R = QQ[x,y,z,w]
f = x^2*y^2*w^2+x*y*z*w^3-y^4*z^2
g = y*w-z^2
f % g
-- Changing the monomial order can change the output in the division algorithm
-- Contrast the following 4 lines of code with the previous 4.
R = QQ[x,y,z,w, MonomialOrder => Lex]
f = x^2*y^2*w^2+x*y*z*w^3-y^4*z^2;
g = y*w-z^2;
f % g
-- If you ask M2 to compute a Grobner basis, it will automatically compute the reduced GB,
-- and sort the basis elements by their leading terms
R = QQ[x,y, MonomialOrder => Lex]
I = ideal(x^3,x^2*y+y^3)
gb I
-- The command "gb" will compute and store the Grobner basis, but it will not display it!
-- To see the actual Grobner basis, try:
gens gb I
-- Note that M2 also always sorts the terms of a polynomial in decreasing order:
f = y^3+x^2+x*y