Ask Your Question

Compute common number field of algebraic numbers

asked 2022-12-13 14:07:35 +0100

philipp7 gravatar image

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 flag offensive 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:

Max Alekseyev gravatar imageMax Alekseyev ( 2022-12-14 01:34:44 +0100 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2022-12-18 10:44:40 +0100

vdelecroix gravatar image

updated 2022-12-18 10:45:15 +0100

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
edit flag offensive delete link more

answered 2022-12-15 13:26:13 +0100

philipp7 gravatar image

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) :
    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_tower = NumberField(y-1, v) # start with QQ 

        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])

        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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2022-12-13 14:07:35 +0100

Seen: 94 times

Last updated: Dec 18 '22