Ask Your Question

GB for I=ideal(x^3-3*x^2-y+1,-x^2+y^2-1) leaves out a further step.

I am looking for an example of solving multivariate polynomials using Groebner basis.

I found a sample solved with GAP.

gap> ideal := [x^3-3*x^2-y+1, -x^2+y^2-1];;
gap> G := ReducedGroebnerBasis(ideal, lex);;
gap> Display(G);
[ y^5+y^4-11*y^3-17*y^2+9*y+17, -y^4+x*y+11*y^2-x+3*y-13, x^2-y^2+1 ]


In Sage, I tried and got

sage: R.<x, y> = QQ[]
sage: R = PolynomialRing(QQ, 'x, y')
sage: x, y = R.gens()
sage: I = ideal(x^3 - 3*x^2 - y + 1, -x^2 + y^2 - 1)
sage: I
Ideal (x^3 - 3*x^2 - y + 1, -x^2 + y^2 - 1) of Multivariate Polynomial Ring in x, y over Rational Field
sage: B = I.groebner_basis()
sage: B
[y^4 - x*y - 11*y^2 + x - 3*y + 13, x*y^2 - 3*y^2 - x - y + 4, x^2 - y^2 + 1]


I could manipulate to get what GAP gives from what I got in Sage.

Is there a way to eliminate x in the first poly automatically?

edit retag close merge delete

Comments

Welcome to Ask Sage! Thank you for your question.

( 2022-02-27 15:29:50 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

Whenever the monomial/term ordering is fixed, the reduced Groebner basis of an ideal is unique (up to reordering of the list of elements). In GAP you used the lexicographic ordering, and in SageMath you didn't specify a monomial ordering, so it used the default of degrevlex, which is not lex, so you got a different result. Here is how to specify the monomial ordering (and get the same result as in GAP, up to reordering):

sage: R.<x, y> = PolynomialRing(QQ, order='lex')
sage: I = R.ideal(x^3 - 3*x^2 - y + 1, -x^2 + y^2 - 1)
sage: I.groebner_basis()
[x^2 - y^2 + 1, x*y - x - y^4 + 11*y^2 + 3*y - 13, y^5 + y^4 - 11*y^3 - 17*y^2 + 9*y + 17]


Or conversely, use GAP to get the same result as in SageMath, by choosing the degrevlex (a.k.a. grevlex) monomial ordering:

gap> R := PolynomialRing(Rationals, [ "x", "y" ]);;
gap> x := IndeterminatesOfPolynomialRing(R)[1];;
gap> y := IndeterminatesOfPolynomialRing(R)[2];;
gap> degrevlex := MonomialGrevlexOrdering(x,y);;
gap> ideal := [x^3-3*x^2-y+1, -x^2+y^2-1];;
gap> G := ReducedGroebnerBasis(ideal, degrevlex);;
gap> Display(G);
[ x^2-y^2+1, x*y^2-3*y^2-x-y+4, y^4-x*y-11*y^2+x-3*y+13 ]

more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Stats

Asked: 2022-02-26 16:47:02 +0200

Seen: 100 times

Last updated: Feb 27 '22