# Compute common number field of algebraic numbers

Suppose we have a list of algebraic numbers, e.g., a1,a2,a3 in QQbar. I want to compute the minimal number field K which contains all these algebraic numbers and I want to get the minimal polynomial of a1,a2,a3 in K. How can I do this?

I know how to convert one element from QQbar to a number field element, e.g.,

sage: a = [QQbar(sqrt(3)), QQbar(sqrt(17)), QQbar(sqrt(5))]
sage: Ka, aK, emb = a[0].as_number_field_element()
sage: aK.absolute_minpoly()
x^2 - 3


I can also define the common number field

sage: K.<u> = NumberField([ai.minpoly() for ai in a])


But now I have no idea how to convert for instance a[0] to an element of K.

edit retag close merge delete

Did you check what is K? It does not look like a common number field. Resultants may come handy for this problem: https://en.wikipedia.org/wiki/Resulta...

( 2022-12-14 01:34:44 +0100 )edit

Sort by ยป oldest newest most voted

There is a (not so well advertized) function for that purpose

sage: from sage.rings.qqbar import number_field_elements_from_algebraics
sage: K, (a, b, c), phi = number_field_elements_from_algebraics([sqrt(3), sqrt(2), 2])


The output is

• K: a number field containing your elements
• (a, b, c): your elements as elements of K
• phi: a morphism from K to QQbar
more

I came up with such a function which for given algebraic numbers returns the common number field and the algebraic numbers as elements in this field:

def to_common_field(l) :
r"""
Given a list of algebraic numbers in QQbar, returns a list of these algebraic numbers
as elements in a minimal number field
"""
with SR.temp_var() as y, SR.temp_var() as v, SR.temp_var(n=len(l)) as u :
QQ_number_field = NumberField(y-1, v) # QQ as number field

l_new = []
# create tower of extensions
for i, a in enumerate(l) :
# get extension field of current element
Ka, aK, _ = QQbar(a).as_number_field_element()

# enlarge field
if Ka == QQ :
Ka = QQ_number_field # can only enlarge with number field not with QQ
aK = Ka(aK)
L_tower, psi, phi, _ = L_tower.composite_fields(Ka, u[i], both_maps=True)[0]
# phi : Ka -> L_tower_new, psi : L_tower_old -> L_tower_new

# move all previously considered elements to new field
for i in range(len(l_new)) :
l_new[i] = psi(l_new[i])
l_new.append(phi(aK))

return L_tower, l_new


Here is an example:

sage: l = [sqrt(3), sqrt(2), 2]
sage: to_common_field(l)
(Number Field in symbol375 with defining polynomial y^4 - 10*y^2 + 1,
[1/2*symbol375^3 - 11/2*symbol375, 1/2*symbol375^3 - 9/2*symbol375, 2])


What would be nice, but I was not able to do this yet, is to additionally return the embedding from the common number field to QQbar such that all elements are mapped to the appropriate algebraic number.

more