# Compute Groebner basis of real polynomials

I'm trying to compute the Groebner basis of an ideal of real polynomials by doing

sage: P.<a,a11,ca11,a12,ca12,b11,cb11,b12,cb12>=RR[];P
Multivariate Polynomial Ring in a, a11, ca11, a12, ca12, b11, cb11, b12, cb12 over Real Field with 53 bits of precision
sage: I = Ideal([-2*a*a11*ca11+2*a*a12*ca12+4*a*b11*cb11-a11*ca11+3*a12*ca12+b11*cb11-3*b12*cb12,3*a*a11*b11-a*a12*b12-ca11*b11+3*a12*b12,sqrt(3)*a*a11*b12-2*a*ca11*b11+sqrt(3)*a*ca12*b11-sqrt
....: (3)*ca11*b12-2*a12*cb12-sqrt(3)*ca12*b11,2*sqrt(3)*a*ca11*a12+2*a*b11^2+2*sqrt(3)*a11*a12-2*b12^2-1,2*a*ca11^2+2*sqrt(3)*a*b11*b12-2*a12^2+2*sqrt(3)*b11*b12])
sage: B = I.groebner_basis(); B


but the output is

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-3-65d08ea3cfe7> in <module>()
----> 1 B = I.groebner_basis(); B

/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/structure/element.pyx in sage.structure.element.Element.__getattr__ (build/cythonized/sage/structure/element.c:4609)()
485             AttributeError: 'LeftZeroSemigroup_with_category.element_class' object has no attribute 'blah_blah'
486         """
--> 487         return self.getattr_from_category(name)
488
489     cdef getattr_from_category(self, name):

/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/structure/element.pyx in sage.structure.element.Element.getattr_from_category (build/cythonized/sage/structure/element.c:4718)()
498         else:
499             cls = P._abstract_element_class
--> 500         return getattr_from_other_class(self, cls, name)
501
502     def __dir__(self):

/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/cpython/getattr.pyx in sage.cpython.getattr.getattr_from_other_class (build/cythonized/sage/cpython/getattr.c:2614)()
392         dummy_error_message.cls = type(self)
393         dummy_error_message.name = name
--> 394         raise AttributeError(dummy_error_message)
395     attribute = <object>attr
396     # Check for a descriptor (__get__ in Python)

AttributeError: 'Ideal_generic' object has no attribute 'groebner_basis'

edit retag close merge delete

Sort by » oldest newest most voted

Replace Ideal by P.ideal.

Replace RR by QQbar, or by K where K.<sqrt3> = NumberField(x^2 - 3); in the latter case also replace sqrt(3) by sqrt3.

You may also want to do list(B) if B gets big.

more

Hmmm....

Replace RR by QQbar

Shouldn't that be AA (i. e. real algebraicals) ?

( 2020-02-04 02:52:26 -0600 )edit

Sure, if you prefer. If an ideal is defined over a field $K$, i.e. it has a set of generators with coefficients in $K$, then a Gröbner basis which is computed by starting with these generators will also be defined over $K$ (the computation involves just polynomial arithmetic, at worst division by nonzero constants in $K$). Since SageMath computes a reduced Gröbner basis, the result will be the same for any field containing a copy of $K$ (here we can take $K=\mathbb{Q}(\sqrt{3})$); the elements will just have a different parent.

( 2020-02-04 04:29:44 -0600 )edit