Michał Garmulewicz - bazy Groebnera

1456 days ago by HaskellCurry

# from sage.rings.polynomial.toy_buchberger import buchberger P1.<x,y,z> = PolynomialRing(ZZ, 3, order='lex') # possible orderings # * 'degrevlex' (default) – degree reverse lexicographic # * 'lex' – lexicographic # * 'deglex' – degree lexicographic f1 = x*y^2*z^2 + x*y - y*z # F = [x-y^2, y-z^3, z^2-1] F = [z^2-1, y - z^3, x - y^2] I = ideal(F) B = I.groebner_basis() print(I) print(B) print(f1.reduce(B)) print(f1.reduce(F)) 
       
Ideal (z^2 - 1, y - z^3, x - y^2) of Multivariate Polynomial Ring in
x, y, z over Integer Ring
[x - 1, y - z, z^2 - 1]
z
z
P2.<x,y,z> = PolynomialRing(ZZ, 3, order='deglex') f2 = x*y^2*z^2 + x*y - y*z # F = [x-y^2, y-z^3, z^2-1] F = [z^2-1, y - z^3, x - y^2] I_prime = ideal(F) B_prime = I_prime.groebner_basis() print(I_prime) print(B_prime) print(f2.reduce(B_prime)) print(f2.reduce(F)) 
       
Ideal (z^2 - 1, -z^3 + y, -y^2 + x) of Multivariate Polynomial Ring
in x, y, z over Integer Ring
[z^2 - 1, x - 1, y - z]
z
x^2 + x*y - y*z
P3.<x,y,z> = P1.change_ring(order='degrevlex') J = I.change_ring(P3) B2 = J.groebner_basis() print(B2) f1.reduce(B2) 
       
[z^2 - 1, x - 1, y - z]
z
P1.<x,y,z> = PolynomialRing(ZZ, 3, order='lex') F = [z^2-1, y - z^3, x - y^2] I = ideal(F) B = I.groebner_basis() print(I) print(B) print(ideal(B)) print(ideal(B)==I) 
       
Ideal (z^2 - 1, y - z^3, x - y^2) of Multivariate Polynomial Ring in
x, y, z over Integer Ring
[x - 1, y - z, z^2 - 1]
Ideal (x - 1, y - z, z^2 - 1) of Multivariate Polynomial Ring in x,
y, z over Integer Ring
True