One could define successive extensions, but the nicest might be to
define individual extensions separately and to construct a composite
field from those.
Define P
, f
, alpha
, beta
as in the question.
sage: P.<x> = QQ[]
sage: f = P([5, 2, 0, 0, 1])
sage: f_roots = f.roots(QQbar, multiplicities=False)
sage: f_roots
[-1.068757255260645? - 0.8212240798160035?*I,
-1.068757255260645? + 0.8212240798160035?*I,
1.068757255260645? - 1.268887367765514?*I,
1.068757255260645? + 1.268887367765514?*I]
sage: alpha, beta = f_roots[:2]
sage: alpha, beta
(-1.068757255260645? - 0.8212240798160035?*I,
-1.068757255260645? + 0.8212240798160035?*I)
Define the number fields $\mathbb{Q}[\alpha]$, $\mathbb{Q}[\beta]$
as embedded number fields, with embeddings in QQbar
.
sage: K.<a> = NumberField(f, 'a', embedding=alpha)
sage: L.<b> = NumberField(f, 'b', embedding=beta)
Now the list of composite fields will contain the only
compatible embedded number field. (Had K
and L
been
constructed without embeddings, there would be several
possible composite fields).
sage: K.composite_fields(L, 'c', both_maps=True)
[(Number Field in c with defining polynomial
x^12 - 54*x^9 + 335*x^8 + 1900*x^6 - 17820*x^5 - 12725*x^4
- 17928*x^3 + 421660*x^2 - 2103750*x + 6284221,
Ring morphism:
From: Number Field in a with defining polynomial x^4 + 2*x + 5
To: Number Field in c with defining polynomial
x^12 - 54*x^9 + 335*x^8 + 1900*x^6 - 17820*x^5 - 12725*x^4
- 17928*x^3 + 421660*x^2 - 2103750*x + 6284221
Defn: a |--> -4787089492308500/19095694682980435222089*c^11
- 60072370481993649/50921852487947827258904*c^10
- 107347330062640525/25460926243973913629452*c^9
+ 54770246058614250/6365231560993478407363*c^8
- 830196451346905669/19095694682980435222089*c^7
- 6929297573110815045/25460926243973913629452*c^6
- 80217555206153510375/38191389365960870444178*c^5
+ 32869508519243998767/25460926243973913629452*c^4
+ 218621879478829109530/19095694682980435222089*c^3
+ 3195870754505273678775/50921852487947827258904*c^2
- 33579832334379607364857/76382778731921740888356*c
+ 315450855301503993255/1106996793216257114324,
Ring morphism:
From: Number Field in b with defining polynomial x^4 + 2*x + 5
To: Number Field in c with defining polynomial
x^12 - 54*x^9 + 335*x^8 + 1900*x^6 - 17820*x^5 - 12725*x^4
- 17928*x^3 + 421660*x^2 - 2103750*x + 6284221
Defn: b |--> -9574178984617000/19095694682980435222089*c^11
- 60072370481993649/25460926243973913629452*c^10
- 107347330062640525/12730463121986956814726*c^9
+ 109540492117228500/6365231560993478407363*c^8
- 1660392902693811338/19095694682980435222089*c^7
- 6929297573110815045/12730463121986956814726*c^6
- 80217555206153510375/19095694682980435222089*c^5
+ 32869508519243998767/12730463121986956814726*c^4
+ 437243758957658219060/19095694682980435222089*c^3
+ 3195870754505273678775/25460926243973913629452*c^2
+ 4611557031581263079321/38191389365960870444178*c
+ 315450855301503993255/553498396608128557162,
-2)]
Extract this composite field.
sage: M.<c>, phi_KM, phi_LM, k = K.composite_fields(L, 'c', both_maps=True)[0]
sage: M
Number Field in c with defining polynomial
x^12 - 54*x^9 + 335*x^8 + 1900*x^6 - 17820*x^5 - 12725*x^4
- 17928*x^3 + 421660*x^2 - 2103750*x + 6284221
sage: M(a)
-4787089492308500/19095694682980435222089*c^11
- 60072370481993649/50921852487947827258904*c^10
- 107347330062640525/25460926243973913629452*c^9
+ 54770246058614250/6365231560993478407363*c^8
- 830196451346905669/19095694682980435222089*c^7
- 6929297573110815045/25460926243973913629452*c^6
- 80217555206153510375/38191389365960870444178*c^5
+ 32869508519243998767/25460926243973913629452*c^4
+ 218621879478829109530/19095694682980435222089*c^3
+ 3195870754505273678775/50921852487947827258904*c^2
- 33579832334379607364857/76382778731921740888356*c
+ 315450855301503993255/1106996793216257114324
sage: M(b)
-9574178984617000/19095694682980435222089*c^11
- 60072370481993649/25460926243973913629452*c^10
- 107347330062640525/12730463121986956814726*c^9
+ 109540492117228500/6365231560993478407363*c^8
- 1660392902693811338/19095694682980435222089*c^7
- 6929297573110815045/12730463121986956814726*c^6
- 80217555206153510375/19095694682980435222089*c^5
+ 32869508519243998767/12730463121986956814726*c^4
+ 437243758957658219060/19095694682980435222089*c^3
+ 3195870754505273678775/25460926243973913629452*c^2
+ 4611557031581263079321/38191389365960870444178*c
+ 315450855301503993255/553498396608128557162
Do some computations.
sage: QQbar(M(a)*M(b))
1.81665105994191? + 0.?e-14*I
sage: alpha*beta
1.81665105994191? + 0.?e-14*I
sage: QQbar(M(a)*M(b)) == alpha*beta
True
sage: QQbar(M(a) + M(b))
-2.137514510521290? + 0.?e-15*I
sage: alpha + beta
-2.137514510521290? + 0.?e-15*I
sage: QQbar(M(a) + M(b)) == alpha + beta
True
Further reading:
number_field_element_from_algebraics
. $\endgroup$