Ask Your Question

Revision history [back]


You should avoid usage of the symbolic ring as much as possible. It is useful to deal with functions, derivations and such but not to deal with arithmetic questions.

There is a class called AlgebraicConverter in sage.symbolic.expression_conversions which is implemented and called in such case. It works well for the field of algebraic numbers QQbar::

sage: QQbar(sqrt(-3))
sage: QQbar(sin(pi/4))

But not for other number fields. Nevertheless it is possible to do

sage: K = QuadraticField(-3)
sage: K(3).sqrt()

The method sqrt above actually uses Pari in the background: if your number field contains such a root it returns it, otherwise the answer will be an element of the symbolic ring.

sage: K(3).sqrt().sqrt()