Groebner basis, division algorithm

1960 days ago by J.Wisniewski

# Groebner basis, division algorithm # # We consider a polynomial ring in three variables with deglex order # P1.<x,y,z> = PolynomialRing(QQ, 3, order='deglex') # we define a list and subsequently and ideal B=[x*z-y^2, x^3-z^2] I1 = ideal(B) # Function groebner_basis() calculates a (reduced) Groebner basis # according to the order which comes with the ring B1 = I1.groebner_basis() print B1 
[y^6 - z^5, x*y^4 - z^4, x^2*y^2 - z^3, x^3 - z^2, x*z - y^2]
f1 = -4*x^2*y^2*z^2 + y^6 + 3*z^5 # We want to check if the polynomial f1 is in I1 # so we use the division algorithm using the Groebner basis B1 f1.reduce(B1) 
# The remainder is zero so f1 is in I1 # We can verify it using the predefined function in sage f1 in I1 
# Note that the remainder will be non-zero # if the set of generators of I1 is not a Groebner basis f1.reduce(B) 
-3*y^6 + 3*z^5
# Now we change the order in the basis ring P2.<x,y,z> = PolynomialRing(QQ, 3, order='degrevlex') # and repeat what we did above B=[x*z-y^2, x^3-z^2] I2 = ideal(B) B2 = I2.groebner_basis() print B2 
[x^3 - z^2, y^2 - x*z]
# we repeat the calculations in the new order f2 = -4*x^2*y^2*z^2 + y^6 + 3*z^5 f2.reduce(B)