# How to get a field extension by adjoining elements

Let $\alpha_1,\alpha_2,\ldots,\alpha_n \in \mathbb{R}$. How to define the field extension $\mathbb{Q}(\alpha_1,\alpha_2,\ldots,\alpha_n)$ in sagemath and how to compute the degree of the extension $[\mathbb{Q}(\alpha_1,\alpha_2,\ldots,\alpha_n):\mathbb{Q}]?$

edit retag close merge delete

Sort by ยป oldest newest most voted

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.

more

Thanks for your help. What if the base field is something other than $\mathbb{Q}$?

( 2023-04-20 15:57:22 +0200 )edit

@sagelearner There is the method relativize.

( 2023-04-21 11:18:09 +0200 )edit