Ask Your Question

Revision history [back]

Here is an example:

sage: a = [I, sqrt(7), sqrt(-7)]
sage: K, a_in_K, hom = number_field_elements_from_algebraics(a, minimal=True)
sage: K
Number Field in a with defining polynomial y^4 - 3*y^2 + 4
sage: a_in_K
[-1/2*a^3 + 1/2*a, -1/2*a^3 + 5/2*a, -2*a^2 + 3]
sage: [z^2 for z in a_in_K]
[-1, 7, -7]
sage: K.degree()
4

See number_field_elements_from_algebraics. In general the elements of a can be taken from AA or QQbar.