# Revision history [back]

First of all, you missed a closing paranthesis on the first line. Secondly, it is better to include code that is working, that is to say include the line

sage: from sage.rings.qqbar import number_field_elements_from_algebraics


Now, if you want to convert a single element, just do

sage: K, elt, phi = r.as_number_field_element()


Then elt is the element of your number field that is the same thing as r. phi is the morphism and you can check

sage: phi(elt) == r
True


First of all, you missed a closing paranthesis on the first line. Secondly, it is better to include code that is working, that is to say include the line

sage: from sage.rings.qqbar import number_field_elements_from_algebraics


Now, if you want to convert a single element, just do

sage: K, elt, phi = r.as_number_field_element()


Then elt is the element of your number field that K (that is the same thing as r. ). phi is the morphism from the number field K to QQbar and you can check

sage: phi(elt) == r
True