Ask Your Question

Revision history [back]

Here is a solution going through QQbar. You first need to create your element as an element of QQbar as follows

sage: x = polygen(ZZ)
sage: a = QQbar.polynomial_root(x^3 + 3, CIF((0.6,0.8),(1.1,1.3)))
sage: a
0.7211247851537042? + 1.249024766483407?*I

Then, there is a ready made function to build the number field that contain a given number of elements

from sage.rings.qqbar import number_field_elements_from_algebraics
sage: number_field_elements_from_algebraics([a.real(), a.imag()], minimal=True)
(Number Field in a with defining polynomial y^6 - 3,
 [1/2*a^2, 1/2*a^5],
 Ring morphism:
   From: Number Field in a with defining polynomial y^6 - 3
   To:   Algebraic Real Field
   Defn: a |--> 1.200936955176003?)

The output is a triple that consists of a number field, the two elements you are looking for and a morphism to QQbar.

Vincent

Here is a solution going through QQbar. You first need to create your element as an element of QQbar as follows

sage: x = polygen(ZZ)
sage: a = QQbar.polynomial_root(x^3 + 3, CIF((0.6,0.8),(1.1,1.3)))
sage: a
0.7211247851537042? + 1.249024766483407?*I

Then, there is a ready made function to build the number field that contain a given number of elements

sage: from sage.rings.qqbar import number_field_elements_from_algebraics
sage: number_field_elements_from_algebraics([a.real(), a.imag()], minimal=True)
(Number Field in a with defining polynomial y^6 - 3,
 [1/2*a^2, 1/2*a^5],
 Ring morphism:
   From: Number Field in a with defining polynomial y^6 - 3
   To:   Algebraic Real Field
   Defn: a |--> 1.200936955176003?)

The output is a triple that consists of a number field, the two elements you are looking for and a morphism to QQbar.

Vincent

Here is a solution going through QQbar. You first need to create your element as an element of QQbar as follows

sage: x = polygen(ZZ)
sage: a = QQbar.polynomial_root(x^3 + 3, CIF((0.6,0.8),(1.1,1.3)))
sage: a
0.7211247851537042? + 1.249024766483407?*I

Then, there is a ready made function to build the number field that contain a given number of elements

sage: from sage.rings.qqbar import number_field_elements_from_algebraics
sage: number_field_elements_from_algebraics([a.real(), a.imag()], minimal=True)
(Number Field in a with defining polynomial y^6 - 3,
 [1/2*a^2, 1/2*a^5],
 Ring morphism:
   From: Number Field in a with defining polynomial y^6 - 3
   To:   Algebraic Real Field
   Defn: a |--> 1.200936955176003?)

The output is a triple that consists of a number field, the two elements you are looking for and a morphism to QQbar.

Vincent