[Next] [Prev] [Right] [Left] [Up] [Index] [Root]
Creation Functions

Creation Functions

Subsections

Creation of General Number Fields

The basic objects in the number field package are number fields and equation orders. Given an irreducible polynomial f with integer coefficients, the number field K isomorphic to Q[X]/f(X) and the equation order E isomorphic to Z[X]/f(X) can be created using the NumberField and EquationOrder functions. Note that it is possible to create the factor rings Q[X]/f(X) and Z[X]/f(X) using the polynomial ring creation functions and the quo constructor, but that construction will only allow the user arithmetic in these rings, and does not in general give access to structural number field computations, unless a special FldNum flag is set.

It is now also possible to make relative extensions, that is, extensions over number fields bigger than Q or orders bigger than Z.

The FieldOfFractions function enables the user to create the number field associated with a given order.

NumberField(f) : AlgPolElt -> FldNum
Given a monic irreducible polynomial f of degree n>1 and irreducible over Q, create the number field K=Q(alpha) obtained by adjoining a root alpha of f to Q. The polynomial f is allowed to have either integer coefficients or coefficients from the rational field, but in the latter case, if denominators greater than 1 occur, an equivalent polynomial will be used: instead of f(x) a root of the integral polynomial f'(x)=d^nf(x/d) is used to define K, where d is the least common multiple of the denominators of the coefficients of f.

The angle bracket notation may be used to assign the root alpha to an identifier: K<y> := NumberField(f).

NumberField(s) : [ AlgPolElt ] -> FldNum
Given a sequence s of monic polynomials s_1, ..., s_m, each of degree greater than 1 and irreducible over Q, create the number field K=Q(alpha_1, ..., alpha_m) obtained by adjoining a root alpha_i of each s_i to Q. The polynomials s_i are allowed to have coeeficients in Z or in Q, but if in the latter case denominators occur in the coefficients of s_i an integral polynomial is used instaed of s_i, as in the case of the definition of a number field by a single polynomial.

If m>1, in fact a tower of extension fields K_0=Q subset K_1=Q((alpha_m) subset K_(2)=Q((alpha_(m - 1), alpha_(m)) subset ... subset K_m = Q(alpha_1, ..., alpha_m)=K is created, and K is a relative extension by s_1 over its ground field K_(m - 1)=Q(alpha_2, ..., alpha_m). Thus the result of this construction is similar to that after m uses of the ext constructor. The angle bracket notation may be used to assign the m generators alpha_i to identifiers: K<a_1, ..., a_m> := NumberField([ a_1, ..., a_m ]); thus the first generator a_1, which corresponds to K.1, generates K over its ground field.

Note that it is left to the user to ensure that in each of the above steps the polynomial s_i is irreducible over K_(i - 1), it is only checked internally that s_i is irreducible over Q.

ext< Q | f > : FldRat, AlgPolElt -> FldNum
ext< K | f > : FldNum, AlgPolElt -> FldNum
Given a monic irreducible polynomial f over the number field K, create the extension field K(alpha) obtained by adjoining a root alpha of f to K. Here K is allowed to be the rational field Q. The polynomial f is allowed to have coefficients in K, or in any order of K; however, if coefficients occur in f which require denominator greater than 1 when expressed on the basis of the equation order of K, the polynomial will be replaced by an equivalent one requiring no such denominators. Unless K equals Q, it is the responsibility of the user to ensure that f is irreducible over K; if K=Q an error results when f is reducible.

The angle bracket notation may be used to assign the root alpha to an identifier: K<y> := ext< Q | f >.

quo< FldNum : R | f > : AlgPol, AlgPolElt -> FldNum
Given a ring of polynomials R in one variable over a number field K, create the number field K(alpha) obtained by adjoining a root alpha 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 the equation order of K, the polynomial will be replaced by an equivalent one requiring no such denominators: f'(x)=d^nf(x/d), where n is the degree of f and d a common denominator. Unless K equals Q, it is the responsibility of the user to ensure that f is irreducible over K; if K=Q an error results when f is reducible.

The angle bracket notation may be used to assign the root alpha 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.

sub< K | e > : FldNum, FldNumElt -> FldNum, Map
Given a number field K with ground field G and an element e in K, return the number field H=G(e) generated by e (over G), as well as the embedding homomorphism from H to K.

Example FldNum_Creation (H28E2)

To create the number field Q(alpha), where alpha is a zero of the integer polynomial x^4 - 420 * x^2 + 40000, one may proceed as follows:

> R<x> := PolynomialRing(Integers());
> f := x^4 - 420*x^2 + 40000;
> K<y> := NumberField(f);
By assigning the generating element to y, we can from here on specify elements in the field as polynomials in y (and the elements will be printed as polynomials in Q[y]/f):

> z := y^5/11;
> print z;
420/11*y^3 - 40000/11*y
This illustrates the second purpose of the angle brackets K<y>, namely for use in output printing. Without the <y> the printing would use $.1 instead.

Example FldNum_Compositum (H28E3)

It is often desirable to build up a number field by adjoining several algebraic numbers to Q. The following function returns a number field that is the composite field of two given number fields K and L, provided that Kintersect L=Q; if K and L have a common subfield larger than Q the function returns a field with the property that it contains a subfield isomorphic to K as well as a subfield isomorphic to L.

> R<x> := PolynomialRing(Integers());
> Composite := function( K, L )
>     cK := Conjugates(K.1);
>     cL := Conjugates(L.1);
>     T<y> := PolynomialRing( Universe(cK) );
>     f := &*[ y - (a+b) : a in cK, b in cL ];
>     fseq := [Round(Real(c)) : c in Coefficients(f) ];
>     factf := Factorization(R!fseq);
>     g := factf[#factf][1];
>     return NumberField( R ! g);
> end function;
 
To create, for example, the field Q(sqrt(2), sqrt(3), sqrt(5)), the above function should be applied twice:

> K := NumberField(x^2-3);
> L := NumberField(x^2-2);
> M := NumberField(x^2-5);
>  KL := Composite(K, L);
>  KLM<w> := Composite(KL, M);
> print KLM;
NumberField( w^8 - 40*w^6 + 352*w^4 - 960*w^2 + 576 )

FieldOfFractions(O) : RngOrd -> FldNum
Return the number field that is the quotient field of the order O.
BetterPolynomial(K) : FldNum -> BoolElt, FldNum
BetterPolynomial(K, d) : FldNum -> BoolElt, FldNum
Given a number field K with ground field Q, this function returns a Boolean value indicating whether or not a polynomial g could be found that is better (in the sense defined below) than the defining polynomial f for K; if the returned value is true, the number field L defined by g is also returned.

If the argument d is not specified, the polynomial g with integer coefficients is defined to be better than f if it is monic, irreducible, defines a number field isomorphic to K and its discriminant is smaller (in absolute value) than that of f. If a second argument d is specified, then g is defined to be better if in addition to the previous requirements d is not an index divisor, that is, if d does not divide the index [O_L : E_L] of the equation order E_L of L in the maximal order O_L.


Example FldNum_BetterPoly (H28E4)

> R<x> := PolynomialRing(Integers());
> K := NumberField(x^4-420*x^2+40000);
> q, L := BetterPolynomial(K);
> print q;
true
> print L;
NumberField( $.1^4 + $.1^3 - 36*$.1^2 - 95*$.1 + 5 )
> r, M := BetterPolynomial(L);
> print r;
false
> f := x^4-420*x^2+40000;
> print Factorization(Discriminant(f));
[ <2, 18>, <5, 8>, <41, 2> ]
> g := x^4+x^3-36*x^2-95*x+5;
> print Factorization(Discriminant(g));
[ <2, 6>, <5, 2>, <41, 2> ]
> OL := MaximalOrder(L);
> EL := EquationOrder(L);
> print Index(OL, EL);
8
As we see from this computation, the prime 5 (as well as 41) still divides the discriminant of g twice. That means that, potentially, 5 would still divide the index of the equation order in the maximal order O_L of L. However, in fact E_L has only index 8 in O_L.

Creation of Orders in Number Fields

An important subring of a number field K is its ring of integers ( O)_K, consisting of integral elements of the field, that is, elements that are roots of monic integer polynomials. Subrings of finite index of the ring of integers consisting of integral elements are called orders of the field; the ring of integers itself is often called the maximal order. The order ( E)_K=Z[alpha] of K=Q(alpha) isomorphic to Q[X]/f(X) is called the equation order of K; obviously ( E)_K subset ( O)_K. Currently KANT allows only the creation of orders O with ( E)_K subset O subset ( O)_K.

EquationOrder(f) : AlgPolElt -> RngOrd
Given an irreducible monic integer polynomial f of degree greater than 1, return the equation order O=Z[X]/f(X) corresponding to f.
EquationOrder(K) : FldNum -> RngOrd
Return the equation order corresponding to the polynomial with which the number field K was defined. Thus this function returns the extension of the equation order of the ground field of K by the defining polynomial of K.
MaximalOrder(K) : FldNum -> RngOrd
IntegerRing(K) : FldNum -> RngOrd
Integers(K) : FldNum -> RngOrd
Create the ring of integers of the number field K; this includes the computation of an integral basis for K. The field K must have Q as its ground field.

Example FldNum_Orders (H28E5)

Once a number field K=Q(alpha) has been created (as in the example above), one can obtain the equation order E=Z[alpha] and the ring of integers O_K simply as follows.

> R<x> := PolynomialRing(Integers());
> K := NumberField(x^4-420*x^2+40000);
> E := EquationOrder(K);
> O := MaximalOrder(K);
> print Index(O, E);
64000
but note that entirely different things happen here: for the equation order nothing has to be computed, but the determination of the maximal order involves the complicated Round 2 (or 4) algorithm. In our particular example above, E is a subring of index 2^9.5^3 in O_K (see also below).
sub< O | a_1, ..., a_r > : RngOrd, RngOrdElt, ..., RngOrdElt -> RngOrd
Create the suborder of O generated (as an algebra over Z) by the elements a_1, ..., a_r in O, that is, create Z[a_1, ..., a_r]. If the algebra does not have full rank as a sub-module of O, an error results. Note however that it is currently not required that 1 is in the sub-ring.
ext< O | a_1, ..., a_r > : RngOrd, RngOrdElt, ..., RngOrdElt -> RngOrd
Given an order O, and elements a_1, ..., a_r in the ring of integers of the field of fractions of O, create the order O[a_1, ..., a_r].
ext< O | f > : RngOrd, RngUPolElt -> RngOrd
Given an order O in a number field K, and a polynomial f of degree n with coefficients in O, create the extension E of O by a root of f (which forms a free module of rank n over O: E isomorphic to O[alpha]); it is necessary that f is irreducible over the field of fractions of O, but this is not checked.
MultiplicatorRing(I) : RngOrdIdl -> RngOrd
Returns the multiplicator ring of the ideal I of the order O, that is, the subring of elements of the field of fractions K of O multiplying I into itself: M={ x: x in K | xI subset I}. Here K must have ground field Q.

Example FldNum_Round2 (H28E6)

To illustrate how the Round 2 algorithm for the determination of the ring of integers works, we present an implementation of it in the Magma language. The key functions are MultiplicatorRing and pRadical, called by the following function pMaximalOverOrder;

> pMaximalOverOrder := function(ord, p)
>        ovr := MultiplicatorRing(pRadical(ord,p));
>        print "index is", Index(ovr, ord);
>        return (Index(ovr, ord) eq 1) select ovr else $$(ovr, p);
> end function;
which finds the largest overorder in which the given order has p-power index. This function is now simply called for the equation order, with all primes dividing the discriminant:

> Round2 := function(E, K)
>        // E should be the equation order of a number field K
>        d := Discriminant(E);
>        fact := Factorization(Abs(d));
>        print fact;
>        M := E;
>        for x in fact do
>             M := M+pMaximalOverOrder(E, x[1]);
>        end for;
>        print "index of equation order in maximal order is:", Index(M, E);
>        return M;
> end function;
In our running example, this produces the following output:

> R<x> := PolynomialRing(Integers());
> K := NumberField(x^4-420*x^2+40000);
> E := EquationOrder(K);
> print Round2(E, K);
[ <2, 18>, <5, 8>, <41, 2> ]
index is 2
index is 4
index is 8
index is 4
index is 2
index is 1
index is 5
index is 25
index is 1
index is 1
index of equation order in maximal order is: 64000
Order with field of fractions: NumberField( $.1^4 - 420*$.1^2 + 40000 )

Creation of Elements

Elements of number fields and of orders are displayed quite differently. Number field elements are always printed as a polynomial (of degree less than the degree of the field) with rational coefficients in the primitive element of the field, that is, as an element of G[x]/f, where f was the defining polynomial of the field, over the ground field G. Since in general G will be a number field itself, elements in relative extensions (G strictly bigger than Q) will be look like multivariate polynomials (in fact they are recursively defined univariate polynomials).

Elements of orders are displayed as sequences of integer coefficients, referrring to the basis of the order. To convert this Z-basis representation to a polynomial expression (in the primitive element of the field of fractions), the element should be coerced into the field (using !).

Because it is sometimes convenient to view field elements with respect to some integral basis that is not the power basis (corresponding to the polynomial representation) we also allow the coercion of field elements into orders: this will return an order element together with an integer denominator, representing the field element.

One(K) : FldNum -> FldNumElt
One(O) : RngOrd -> RngOrdElt
Identity(K) : FldNum -> FldNumElt
Identity(O) : RngOrd -> RngOrdElt
Zero(K) : FldNum -> FldNumElt
Representative(K) : FldNum -> FldNumElt
Zero(O) : RngOrd -> RngOrdElt
Representative(O) : RngOrd -> RngOrdElt
K ! a : FldNum, RngIntElt -> FldNumElt
elt< K | a > : FldNum, RngIntElt -> FldNumElt
Coerce a into the field K. Here a may be an integer or a rational field element, or an element from a subfield of K, or from an order in such.
K ! [a_0, a_(1), ..., a_(m - 1)] : FldNum, [FldRatElt] -> FldNumElt
elt< K | [ a_0, a_(1), ..., a_(m - 1) ] > : FldNum, SeqEnum[FldRatElt] -> FldNumElt
elt< K | a_0, a_(1), ..., a_(m - 1)> : FldNum, FldRatElt , ..., FldRatElt -> FldNumElt
Given the number field, K=G(alpha) of degree m and a sequence [a_0, ..., a_(m - 1)] of elements of G, construct the element a_0 + a_1alpha + ... a_(m - 1)alpha^(m - 1) of K.
O ! a : RngOrd, FldNumElt -> RngOrdElt
elt< O | a > : RngOrd, FldNumElt -> RngOrdElt
Coerce a into the order O. Here a is allowed to be an integer, or an integral element of the field of fractions of O.
O ! [a_0, a_(1), ..., a_(m - 1)] : RngOrd, [ RngIntElt ] -> RngOrdElt
elt< O | [ a_0, a_1, ..., a_(m - 1) ] > : RngOrd, SeqEnum[RngIntElt] -> RngOrdElt
elt< O | a_0, a_1, ..., a_(m - 1) > : RngOrd, RngIntElt, ..., RngIntElt -> RngOrdElt
Given the order O of a number field K of degree m and elements a_0, a_(1), ..., a_(m - 1) in the ground order of O, construct the element a_0alpha_0 + a_1 * alpha_1 + ... a_(m - 1) * alpha_(m - 1) of O, where alpha_0, ..., alpha_(m - 1) is the integral basis for the order.
ElementToSequence(a) : FldNumElt -> [ FldRatElt ]
Eltseq(a) : FldNumElt -> [ FldRatElt ]
ElementToSequence(a) : RngOrdElt -> [ FldRatElt ]
Eltseq(a) : RngOrdElt -> [ FldRatElt ]
For an element a of a number field K, a sequence of coefficients (of length degree of K) with respect to the power basis is returned. For an element of an order O, the sequence of (integral) coefficients of the element with respect to the basis of O are returned.

Example FldNum_Elements (H28E7)

Here are two ways of creating the same integral element in K as an element of the maximal order.

> R<x> := PolynomialRing(Integers());
> K<y> := NumberField(x^4-420*x^2+40000);
> O := MaximalOrder(K);
> e := O ! (y^2/40 + y/4);
> f := elt< O | [0, 0, 1, 0]>;
> print f eq e;
true
The construction will fail if the element is not in O.

Creation of Ideals in Orders

The general ideal constructor can be used to create ideals in orders of number fields, as described below. It should be noted that ideals in orders are allowed to be fractional ideals, so we allow number field elements as generators.

ideal< O | a_1, a_2, ... , a_m > : RngOrd, FldNumElt, ..., FldNumElt -> RngOrdIdl
Given an order O, as well as elements a_1, a_2, ..., a_n coercible into the field of fractions K of O, create the fractional ideal of O generated by these elements.

Note that, contrary to the general case for the constructors, the right hand side elements are not necessarily contained in the left hand side.

The denominator of the ideal will be the smallest positive integer d such that all d.a_i are contained in O; the ideal will then be 1/d times the integral ideal generated by the d.a_i, i=1, ..., m.

    Normal: Integer                     Default: 1

Using the optional argument Normal it is possible to specify that the elements given form a two-element presentation for the ideal. In this case m=1 or m=2 (that is, one or two generators can be specified only); Normal := n for some integer n>1 indicates that the two elements form a two element n-normal presentation for the ideal. If n=1, the presentation may or may not be normal.


Example FldNum_Ideals (H28E8)

We give an example of the creation of an ideal generated by an element from an overorder.

> R<x> := PolynomialRing(Integers());
> f := x^4-420*x^2+40000;
> K<y> := NumberField(f);
> E := EquationOrder(K);
> O := MaximalOrder(K);
> elt := O ! (y^2/40+y/4);
> print elt in E;
false
> I := ideal< E | elt >;
Note that, once the polynomial ring has been defined as above, the ideal can be defined in just one statement as follows.

> I := ideal< EquationOrder(NumberField(x^4-420*x^2+40000)) | [0, 1/4, 0, 1/40] >;

[Next] [Prev] [Right] [Left] [Up] [Index] [Root]