Ask Your Question
2

Why is .groebner_basis only defined for a LaurentPolynomialRing on two or more generators?

asked 2021-08-05 19:53:48 +0200

cgodfrey gravatar image

If I run the code

Q.<x> = LaurentPolynomialRing(QQ)
I = Q.ideal([x - x^-1 + x^2])
print(I.groebner_basis())

I get the error: TypeError: unable to convert Univariate Laurent Polynomial Ring in x over Rational Field to a rational. But if I change it to Q.<x,y> or Q.<x,y,z>, it works fine and is able to print a Groebner basis. On the documentation page, it seems like it would map to the ring Q[x1,x2]/(x1x2-1) and find a Groebner basis there, but I don't see any reason why this would fail but Q[x1, x2, x3, x4]/(x1x2-1, x3x4-1) would succeed.

edit retag flag offensive close merge delete

Comments

Bug is already in I.polynomial_ideal()

FrédéricC gravatar imageFrédéricC ( 2021-08-06 11:44:26 +0200 )edit

1 Answer

Sort by » oldest newest most voted
2

answered 2021-08-07 17:03:18 +0200

tmonteil gravatar image

There are two different implementations for LaurentPolynomialRing depending on whether there is one or more indeterminates:

sage: Q.<x> = LaurentPolynomialRing(QQ)
sage: type(Q)
<class 'sage.rings.polynomial.laurent_polynomial_ring.LaurentPolynomialRing_univariate_with_category'>
sage: Q.<x,y> = LaurentPolynomialRing(QQ)
sage: type(Q)
<class 'sage.rings.polynomial.laurent_polynomial_ring.LaurentPolynomialRing_mpair_with_category'>

Each implementation comes with its own methods.

A trick to benefit from the multivariate implementation of groebner_basis is to define Q as a multivariate Laurent Polynomial Ring, but with 1 indeterminate:

sage: Q.<x> = LaurentPolynomialRing(QQ, 1)
sage: type(Q)
<class 'sage.rings.polynomial.laurent_polynomial_ring.LaurentPolynomialRing_mpair_with_category'>

Note the 1 at the end of the first command.

Then, you can do:

sage: I = Q.ideal([x - x^-1 + x^2])
sage: I.groebner_basis()
(x^3 + x^2 - 1,)
edit flag offensive delete link more

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2021-08-05 19:53:48 +0200

Seen: 104 times

Last updated: Aug 07 '21