Ask Your Question

Revision history [back]

You should not use RR which stands for floating point approximations of real numbers.

The simples to get exact solutions is to use QQbar (= algebraic closure of QQ)

sage: sqrt2 = QQbar(2) ^ (1/2)
sage: sqrt2
sage: sqrt2.n(100)
sage: sqrt2.minpoly()
x^2 - 2

But mixing it with groebner bases I got

sage: B.subs(z=QQbar(2).sqrt())
Traceback (most recent call last):
ValueError: Cannot coerce irrational Algebraic Real 1.414213562373095? to Rational