Creation Functions

The following describes how number fields may be created. It also shows some ways of creating elements of these rings and homomorphisms from these rings into an arbitrary ring.

Contents

Creation of Number Fields

Algebraic Number Fields can be created in a various ways, most of which involve polynomials. The fields can be created as absolute extensions, i.e. an extension of Q by one or more irreducible polynomial(s), or as a relative extension which is an extension of an algebraic field by one or more polynomial(s) irreducible over that field.

NumberField(f) : RngUPolElt -> FldNum
    Check: BoolElt                      Default: true
    DoLinearExtension: BoolElt          Default: false
    Global: BoolElt                     Default: false
Given an irreducible polynomial f of degree n≥1 over K = Q or some number field K, create the number field L=K(α) obtained by adjoining a root α of f to K.

The polynomial f is allowed to have either integer coefficients, coefficients in an order of K, coefficients from the rational field or some algebraic field K. The field K will be referred to as CoefficientField. If the polynomial is defined over a field and the coefficients have denominators greater than 1, an equivalent polynomial df(x) is used to define L, where d is the least common multiple of the denominators of the coefficients of f.

If the optional parameter Check is set to false then the polynomial is not checked for irreducibility. This is useful when building relative extensions where factoring can be time consuming.

If DoLinearExtension is true and the degree of f is 1 a trivial extension is returned. This is an object of type FldNum but of degree 1. Otherwise (or by default), the coefficient field of f is returned. (This is important in situations where the number of extensions matters.) Furthermore, a degree 1 extension of Q is a field isomorphic to Q, but regarded by Magma as a number field (while Q itself is not, since FldRat is not a subtype of FldNum). This then supports all of the number field functions (including for instance fractional ideals) while the Rationals() do not. On the other hand, arithmetic will be slower.

If Global is true, then Magma checks if this polynomial is the defining polynomial of some other field created using Global := true. In this case, the old field will be returned.

The angle bracket notation may be used to assign the root α to an identifier e.g. L<y> := NumberField(f) where y will be a root of f.

RationalsAsNumberField() : -> FldNum
QNF() : -> FldNum
This creates a number field isomorphic to Q. It is equivalent to NumberField(x-1 : DoLinearExtension), where x is PolynomialRing(Rationals()).1.

The result is a field isomorphic to Q, but regarded by Magma as a number field (while Q itself is not, since FldRat is not a subtype of FldNum). It therefore supports all of the number field functions, while the Rationals() do not. On the other hand, arithmetic will be slower.

Coercion can be used to convert to and from the Rationals().

NumberField(s) : [ RngUPolElt ] -> FldNum
    Check: BoolElt                      Default: true
    DoLinearExtension: BoolElt          Default: false
    Abs: BoolElt                        Default: false
Let K be a possibly trivial algebraic extension of Q. K will be referred to as the CoefficientField.

Given a sequence s of nonconstant polynomials s1, ..., sm, that are irreducible over K, create the number field L=K(α1, ..., αm) obtained by adjoining a root αi of each si to K. The polynomials si are allowed to have coefficients in an order of K (or Z) or in K or a suitable field of fractions, but if in the latter cases denominators occur in the coefficients of si, an integral polynomial is used instead of si, as in the case of the definition of a number field by a single polynomial.

If m>1 and Abs is false, a tower of extension fields L0=K⊂L1=K(αm) ⊂L2=K(αm - 1, αm)⊂ ... ⊂Lm = K(α1, ..., αm)=L is created, and L is a relative extension by s1 over its ground field Lm - 1=K(α2, ..., αm). Thus, this construction has the same effect as m applications of the ext constructor. The angle bracket notation may be used to assign the m generators αi to identifiers: L<a1, ..., am> := NumberField([ s1, ..., sm ]); thus the first generator a1, which corresponds to L.1, generates L over its ground field.

Note that it is important to ensure that in each of the above steps the polynomial si is irreducible over Li - 1; by default Magma will check that this is the case. If the optional parameter Check is set to false then this checking will not be done.

If the optional parameter Abs is changed to true, then a non-simple extension will be returned. This is a extension of the coefficient field of the fi but such that the base field of L will be K. The ith generator will be a root of the ith polynomial in this case, but all of the generators will have L as parent. In this case, a sparse representation of number field elements will be used (based on multivariate polynomial rings). As a consequence, costs for arithmetic operations will (mainly) depend on the number of non-zero coefficients of the elements involved rather than the field degree. This allows to define and work in fields of degree <106. However, for general elements this representation is slower than the dense (default) representation.

If the optional parameter DoLinearExtension is set to true, linear polynomials will not be removed from the list.

ext< F | s1, ..., sn > : FldNum, RngUPolElt, ..., RngUPolElt -> FldNum
ext<F | s> : FldNum, [RngUPolElt] -> FldNum
ext< Q | s1, ..., sn > : FldRat, RngUPolElt, ..., RngUPolElt -> FldNum
ext< Q | s > : FldRat, [RngUPolElt] -> FldNum
    Check: BoolElt                      Default: true
    Global: BoolElt                     Default: false
    Abs: BoolElt                        Default: false
    DoLinearExtension: BoolElt          Default: false
Construct the number field defined by extending the number field F by the polynomials si or the polynomials in the sequence s. Similar as for NumberField(S) described above, F may be Q. A tower of fields similar to that of NumberField is created and the same restrictions as for that function apply to the polynomials that can be used in the constructor.

Example FldNum_Creation (H36E1)

To create the number field Q(α), where α is a zero of the integer polynomial x4 - 420x2 + 40000, one may proceed as follows:
> R<x> := PolynomialRing(Integers());
> f := x^4 - 420*x^2 + 40000;
> K<y> := NumberField(f);
> Degree(K);
> K;
Number Field with defining polynomial x^4 - 420*x^2 + 40000 over the Rational
Field
> y^4 - 420*y^2;
-40000
By assigning the generating element to y, we can from here on specify elements in the field as polynomials in y. The elements will always be printed as polynomials in Q[y]/f:
> z := y^5/11;
> z;
1/11*(420*y^3 - 40000*y)

K can be further extended by the use of either ext or NumberField.

> R<y> := PolynomialRing(K);
> f := y^2 + y + 1;
> L := ext<K | f>;
> L;
Number Field with defining polynomial y^2 + y + 1 over K
This is equivalent to
> KL := NumberField([x^2 + x + 1, x^4 - 420*x^2 + 40000]);
> KL;
Number Field with defining polynomial $.1^2 + $.1 + 1 over its ground field
but different to
> LK := NumberField([x^4 - 420*x^2 + 40000, x^2 + x + 1]);
> LK;
Number Field with defining polynomial $.1^4 - 420*$.1^2 + 40000 over its ground
field
To illustrate the use of Global:
> K1 := NumberField(x^3-2 : Global);
> K2 := NumberField(x^3-2 : Global);
> L1 := NumberField(x^3-2);
> L2 := NumberField(x^3-2);
> K1 eq K2;
true
> K1 eq L1;
false
> L1 eq L2;
false;
> K1!K2.1;
K1.1;
> K2!K1.1;
K1.1
>> L1!L2.1;
     ^
Runtime error in '!': Arguments are not compatible
LHS: FldNum
RHS: FldNumElt
A typical application of DoLinearExtension is as follows. To construct a Kummer extension of degree p, one has to start with a field containing the p-th roots of unity. In most situation this will be a field extension of degree p - 1, but what happens if ζp is already in the base field?
> AdjoinRoot := function(K, p: DoLinearExtension := false)
>   f := CyclotomicPolynomial(p);
>   f := Polynomial(K, f);
>   f := Factorisation(f)[1][1];
>   return ext<K|f : DoLinearExtension := DoLinearExtension>;
> end function;
> K := NumberField(x^2+x+1);
> E1 := AdjoinRoot(K, 3);
> E1;
Number Field with defining polynomial x^2 + x + 1 over the
Rational Field
> E2 := AdjoinRoot(K, 3 : DoLinearExtension);
> E2;
Number Field with defining polynomial ext<K|>.1 - K.1 over
K
> Norm(E1.1);
1
> Norm(E2.1);
K.1
> Norm($1);
1
RadicalExtension(F, d, a) : Rng, RngIntElt, RngElt -> FldNum
    Check: BoolElt                      Default: true
Let F be a number field. Let a be an integral element of F chosen such that a is not an n-th power for any n dividing d. Returns the number field obtained by adjoining the d-th root of a to F.
SplittingField(F) : FldNum -> FldNum, SeqEnum
NormalClosure(F) : FldNum -> FldNum, SeqEnum
    Abs: BoolElt                        Default: true
    Opt: BoolElt                        Default: true
Given a number field F, this computes the splitting field of its defining polynomial. The roots of the defining polynomial in the splitting field are also returned.

If Abs is true, the resulting field will be an absolute extension, otherwise a tower is returned.

If Opt is true, an attempt of using OptimizedRepresentation is done. If successful, the resulting field will have a much nicer representation. On the other hand, computing the intermediate maximal orders can be extremely time consuming.

SplittingField(f) : RngUPolElt -> FldNum
Given an irreducible polynomial f over Z, return its splitting field.
SplittingField(L) : [RngUPolElt] -> FldNum, [FldNumElt]
    Abs: BoolElt                        Default: false
    Opt: BoolElt                        Default: false
Given a sequence L of polynomials over a number field or the rational numbers, compute a common splitting field, ie. a field K such that every polynomial in L splits into linear factors over K. The roots of the polynomials are returned as the second return value.

If the optional parameter Abs is true, then a primitive element for the splitting field is computed and the field returned will be generated by this primitive element over Q. If in addition Opt is also true, then an optimized representation of K is computed as well.

sub< F | e1, ..., en > : FldAlg, FldAlgElt, ..., FldAlgElt -> FldAlg, Map
sub< F | S > : FldAlg, SeqEnum -> FldAlg, Map
Given a number field F with coefficient field G and n elements ei∈F, return the number field H=G(e1, ..., en) generated by the ei (over G), as well as the embedding homomorphism from H to F.
MergeFields(F, L) : FldNum, FldNum -> SeqEnum
CompositeFields(F, L) : FldNum, FldNum -> SeqEnum
Let F and L be absolute number fields. Returns a sequence of fields [M1, ..., Mr] such that each field Mi contains both a root of the generating polynomial of F and a root of the generating polynomial of L.

In detail: Suppose that F is the smaller field (wrt. the degree). As a first step we factorise the defining polynomial of L over F. For each factor obtained, an extension of F is constructed and then transformed into an absolute extension. The sequence of extension fields is returned to the user.

Compositum(K, L) : FldNum, FldNum -> FldNum
For absolute number fields K and L, at least one of which must be normal, find a smallest common over field. Note that in contrast to CompositeFields above the result here is essentially unique since one field was normal.
quo< FldNum : R | f > : RngUPol, RngUPolElt -> FldNum
    Check: BoolElt                      Default: true
Given a ring of polynomials R in one variable over a number field K, create the number field K(α) obtained by adjoining a root α of f to K. Here the coefficient ring K of R is allowed to be the rational field Q. The polynomial f is allowed to have coefficients in K, but if coefficients occur in f which require denominator greater than 1 when expressed on the basis of K, the polynomial will be replaced by an equivalent one requiring no such denominators: tilde f(x)=df(x), where d is a common denominator. The parameter Check determines whether the polynomial is checked for irreducibility.

The angle bracket notation may be used to assign the root α to an identifier: K<y> := quo< FldNum : R | f >.

If the category FldNum is not specified, quo< R | f > creates the quotient ring R/f as a generic ring (not as a number field), in which only elementary arithmetic is possible.

Example FldNum_CompositeFields (H36E2)

To illustrate the use of CompositeFields we will use this function to compute the normal closure of Q(α) where α is a zero of the integer polynomial x3 - 2:
> K := RadicalExtension(Rationals(), 3, 2);
> l := CompositeFields(K, K);
> l;
[
    Number Field with defining polynomial $.1^3 - 2 over the Rational
    Field,
    Number Field with defining polynomial $.1^6 + 108 over the Rational
    Field
]
The second element of l corresponds to the smallest field L2 containing two distinct roots of x3 - 2. Since the degree of K is 3, L2 is the splitting field of f and therefore the normal closure of K.
OptimizedRepresentation(F) : FldNum -> FldNum, Map
OptimisedRepresentation(F) : FldNum -> FldNum, Map
Given a number field F with ground field Q, this function will attempt to find an isomorphic field L with a better defining polynomial than the one used to define F. If such a polynomial is found then L is returned along with a map from F into L; otherwise F will be returned. For more details, please refer to OptimizedRepresentation in Chapter NUMBER FIELDS AND ORDERS.

Example FldNum_opt-rep (H36E3)

Some results of OptimizedRepresentation are shown.
> R<x> := PolynomialRing(Rationals());
> K := NumberField(x^4-420*x^2+40000);
> L := OptimizedRepresentation(K);
> L ne K;
true
> L;
Number Field with defining polynomial x^4 - 4*x^3 -
    17*x^2 + 42*x + 59 over the Rational Field
> L eq OptimizedRepresentation(L);

Maximal Orders

The maximal order (O)K is the ring of integers of an algebraic field consisting of all integral elements of the field; that is, elements which are roots of monic integer polynomials. It may also be called the number ring of a number field. It is arguably the single most important invariant of a number field, in fact in number theory when one talks about units, ideals, etc. of number fields, it is typically implied that the maximal order is the underlying ring.

Maximal orders and orders in general are explained in detail in Chapter NUMBER FIELDS AND ORDERS, here we only give a very brief overview.

There are a number of algorithms which Magma uses whilst computing maximal orders. The main ones are the Round--2 and the Round--4 methods ([Coh93], [Bai96], [Poh93], [PZ89] for absolute extensions and [Coh00], [Fri97], [Pau01] for relative extensions).

MaximalOrder(F) : FldNum -> RngOrd
IntegerRing(F) : FldNum -> RngOrd
Integers(F) : FldNum -> RngOrd
RingOfIntegers(F) : FldNum -> RngOrd
    Al: MonStgElt                       Default: "Auto"
    SetVerbose("MaximalOrder", n):      Maximum: 5
Create the ring of integers of the algebraic number field F. An integral basis for F can be found as the basis of the maximal order.

For information on the parameters, see Section Maximal Orders.

Creation of Elements

Since number fields are though of as quotients of (multivariate) polynomial rings, elements in those fields are represented as (multivariate) polynomials in the generator(s) of the field.

One(K) : FldNum -> FldNumElt
Identity(K) : FldNum -> FldNumElt
Zero(K) : FldNum -> FldNumElt
Representative(K) : FldNum -> FldNumElt
F ! a : FldNum, RngElt -> FldNumElt
elt< F | a > : FldNum, RngElt -> FldNumElt
Coerce a into the number field F. Here a may be an integer or a rational field element, or an element from a subfield of F, or from an order in such or any other field related to F through chains of subfields, optimised representation, absolute fields, etc.
F ! [a0, a1, ..., am - 1] : FldNum, [RngElt] -> FldNumElt
elt< F | [ a0, a1, ..., am - 1 ] > : FldNum, SeqEnum[RngElt] -> FldNumElt
elt< F | a0, a1, ..., am - 1> : FldNum, RngElt , ..., RngElt -> FldNumElt
Given the number field, F of degree m over its ground field G and a sequence [a0, ..., am - 1] of elements of G, construct the element a0α0 + a1α1 + ... am - 1αm - 1 of F where the αi are the basis elements of F. In case F was generated by a root of a single polynomial, we will always have αi = (F.1)i. If F was defined using multiple polynomials and the Abs parameter, the basis will consist of products of powers of the generators.
Random(F, m) : FldNum, RngIntElt -> FldNumElt
A random element of the number field F. The maximal size of the coefficients is determined by the integer m.

Example FldNum_Elements (H36E4)

> R<x> := PolynomialRing(Integers());
> K<y> := NumberField(x^4-420*x^2+40000);
> y^6;
136400*y^2 - 16800000
> K![-16800000, 0, 136400, 0];
136400*y^2 - 16800000
> K := NumberField([x^3-2, x^2-5]:Abs);
> Basis(K);
[
    1,
    K.1,
    K.1^2,
    K.2,
    K.1*K.2,
    K.1^2*K.2
]
> K![1,2,3,4,5,6];
6*K.1^2*K.2 + 3*K.1^2 + 5*K.1*K.2 + 2*K.1 + 4*K.2 + 1

Creation of Homomorphisms

To specify homomorphisms from number fields, it is necessary to specify the image of the generating elements, and possible to specify a map on the coefficient field.

hom< F -> R | r > : FldNum, Rng, RngElt -> Map
hom< F -> R | h, r > : FldNum, Rng, Map, RngElt -> Map
hom< F -> R | r > : FldNum, Rng, [RngElt] -> Map
hom< F -> R | h, r > : FldNum, Rng, Map, [RngElt] -> Map
Given an algebraic number field F, defined as an extension of the coefficient field G, as well as some ring R, build the homomorphism φ obtained by sending the defining primitive element α of F to the element r∈R.

In case the field F was defined using multiple polynomials, instead of an image for the primitive element, one has to give images for each of the generators.

It is possible (if G=Q) and sometimes necessary (if G != Q) to specify a homomorphism φ on F by specifying its action on G by providing a homomorphism h with G as its domain and R its codomain together with the image of α. If R does not cover G then the homomorphism h from G into R is necessary to ensure that the ground field can be mapped into R.

Example FldNum_Homomorphisms (H36E5)

We show a way to embed the field Q(Sqrt(2)) in Q(Sqrt(2) + Sqrt(3)). The application of the homomorphism suggests how the image could have been chosen.
> R<x> := PolynomialRing(Integers());
> K<y> := NumberField(x^2-2);
> KL<w> := NumberField(x^4-10*x^2+1);
> H := hom< K -> KL | (9*w-w^3)/2 >;
> H(y);
1/2*(-w^3 + 9*w)
> H(y)^2;
2
V2.28, 13 July 2023