In order to use Hecke, it needs loading:
using Hecke
Welcome to _ _ _ | | | | | | | |__| | ___ ___| | _____ | __ |/ _ \/ __| |/ / _ \ | | | | __/ (__| < __/ |_| |_|\___|\___|_|\_\___| Version 0.15.8 ... ... which comes with absolutely no warranty whatsoever (c) 2015-2022 by Claus Fieker, Tommy Hofmann and Carlo Sircana
Do define number fields, in general we need polynmials, so we define a polynomial ring, then a number field. $a$ will be the primitive element, hence a root of $x^2-10$
Qx, x = FlintQQ["x"]
k, a = number_field(x^2-10)
(Number field over Rational Field with defining polynomial x^2 - 10, _a)
To extend further, we need polynomials over $k$, then we can define an extension.
kt,t = k["t"]
(Univariate Polynomial Ring in t over k, t)
K, b = number_field(t^3-a*t+a+1)
(Relative number field with defining polynomial t^3 - _a*t + _a + 1 over Number field over Rational Field with defining polynomial x^2 - 10, _$)
For many algorithm, finding a primitive element is important. The maps are the isomorphism between the relative and absolute fields and the embedding from $k$.
Ka, m1, m2 = Hecke.simplified_absolute_field(K)
(Number field over Rational Field with defining polynomial x^6 + 2*x^3 - 10*x^2 + 20*x - 9, Map with following data Domain: ======= Ka Codomain: ========= Relative number field with defining polynomial t^3 - _a*t + _a + 1 over k, Map with following data Domain: ======= k Codomain: ========= Ka)
To check that $m_2$ is indeed the embedding, we veryify $m_2(a)^2 = 10$:
m2(a)
-1//2*_a^5 - 1//2*_a^4 - 1//2*_a^3 - 1//2*_a^2 + 9//2*_a - 11//2
ans^2
10
Given that we did not assign a name to the primitive element of $K_a$ it is printed generically:
preimage(m1, b)
_a
Checking that is still satisfies the equation for $b$:
ans^3-m2(a)*ans+m2(a)
-1
and some invariants..
norm(b), discriminant(K), norm(b, FlintQQ)
(-_a - 1, -14*_a - 297, -9)
In addition to absolute and relative fields given via a polynomial (hence a primitive element) we also have {\em non-simple} fields, given via the roots of several polynomials. Note: the ideal defined by the polynomials needs to be maximal. This is not verified.
k, g = number_field([x^2-3, x^2-5, x^2-7])
(Non-simple number field with defining polynomials fmpq_mpoly[x1^2 - 3, x2^2 - 5, x3^2 - 7], NfAbsNSElem[_$1, _$2, _$3])
g[1]^2
3
[x^2 for x = basis(k)]
8-element Vector{NfAbsNSElem}: 1 3 5 15 7 21 35 105
Similar to above, we can convert to a primitive representation:
ks, ms = simple_extension(k)
(Number field over Rational Field with defining polynomial x^8 - 60*x^6 + 782*x^4 - 3180*x^2 + 3481, Map with following data Domain: ======= ks Codomain: ========= k)
ms\g[1]
3//7552*_a^7 - 121//7552*_a^5 - 663//7552*_a^3 + 11405//7552*_a
ans^2
3