Ask Your Question

Revision history [back]

You can change the ring over which your polynomial ring is defined, to be the field of algebraic numbers (note the QQbar instead of QQ in the first line):

sage: P.<x,y,z> = PolynomialRing(QQbar, order='lex')
sage: PList = [x^2+y^2+z^2-4, x^2+2*y^2-5, x*z-1]
sage: I = ideal(PList)
sage: B = I.groebner_basis(); B
verbose 0 (3369: multi_polynomial_ideal.py, groebner_basis) Warning: falling back to very slow toy implementation.
[x + 2*z^3 + (-3)*z, y^2 - z^2 - 1, z^4 + (-3/2)*z^2 + 1/2]

Then:

sage: B.subs(z=1)
[x - 1, y^2 - 2, 0]

sage: B.subs(z=1/sqrt(2))
[x - 1.414213562373095?, y^2 - 3/2, 0]