NumberTheory`AlgebraicNumberFields`This package introduces functions for computation within finite algebraic extensions of rationals. For more information on the notions and algorithms used, see for instance H. Cohen, A Course In Computational Algebraic Number Theory, SpringerVerlag, 1993. Mathematica provides representation of algebraic numbers as Root objects. A Root object contains the minimal polynomial of the algebraic number and the root numberan integer indicating which of the roots of the minimal polynomial the Root object represents. This allows for unique representation of arbitrary complex algebraic numbers. A disadvantage is that performing arithmetic operations in this representation is quite costly. That is why Mathematica requires the use of an additional function, RootReduce, in order to simplify arithmetic expressions. If we restrict ourselves to computations within a fixed finite algebraic extension, (), of rationals, we can use a more convenient representation of elements of (), namely as polynomials in . Representation of algebraic numbers as elements of a finite extension of rationals. This loads the package. If f is a monic irreducible polynomial function of degree l with integer coefficients, and are rational numbers, then is an inert numeric object.
Out[2]=  
N can be used to find a numeric approximation of an Algebraic object.
Out[3]=  
For any f and k for which = Root[f, k] evaluates to an algebraic number, and for any list of rational numbers , evaluates to , such that = Root[g, n] ⩵ d , where d is a factor of the leading coefficient of the minimal polynomial of , such that is an algebraic integer, m is the degree of g, and
Algebraic automatically makes the polynomial defining the extension monic and the coefficient list equal in length to the degree of the extension.
Out[4]=  
If the polynomial f specified in Algebraic is reducible, we get the field extension specified by the irreducible factor of f whose root is Root[f, k].
Out[5]=  
Algebraic objects representing rational numbers reduce automatically to numbers.
Out[6]=  
Adding or multiplying Algebraic objects that explicitly belong to the same field (i.e. have the same first and third elements), adding or multiplying a rational number and an Algebraic object, or raising an Algebraic object to an integer power yields an Algebraic object.
Out[9]=  
RootReduce transforms Algebraic objects to Root objects.
Out[10]=  
Functions for representing arbitrary algebraic numbers as elements of algebraic number fields. ToCommonField can be used to find a common finite extension of rationals containing the given algebraic numbers.
Out[11]=  
This represents as an element of the field generated by Root[4].
Out[12]=  
Arithmetic within a fixed finite extension of rationals is much faster than arithmetic within the field of all complex algebraic numbers. Suppose we need to find the value of rational function f with {x, y, z} replaced by algebraic numbers {a, b, c}. A direct computation of the value of f at {a, b, c} using RootReduce takes a rather long time.
Out[15]=  
A faster alternative is to do the computation in a common algebraic number field containing {a, b, c}.
Out[16]=  
Arithmetic within the common number field is much faster.
Out[17]=  
Converting the resulting Algebraic object to a Root object is fast as well.
Out[18]=  
Options of ToCommonField. With the default option setting, SmallestField > False ToCommonField does not check whether Algebraic objects in the input generate their number fields, and therefore it may find a common field that is not the smallest possible. Here the first Algebraic object is equal to so it does not generate the 4th degree field (Root[4]) it is represented in. However the common field found by ToCommonField contains the whole field (Root[4]).
Out[19]=  
Setting SmallestField > True makes ToCommonField find the smallest field possible.
Out[20]=  
Functions for computing algebraic number properties. The minimal polynomial of an algebraic number a is the lowest degree polynomial f with integer coefficients and the smallest positive leading coefficient, such that f(a) ⩵ 0. This gives the minimal polynomial of expressed as a pure function.
Out[21]=  
This gives the minimal polynomial of expressed as a polynomial in x.
Out[22]=  
An algebraic number is an algebraic integer iff its MinimalPolynomial is monic. This shows that is an algebraic integer.
Out[23]=  
This shows that is not an algebraic integer.
Out[24]=  
This gives the smallest positive integer n for which n is an algebraic integer.
Out[25]=  
The trace of an algebraic number a is the sum of all roots of MinimalPolynomial[a]. This gives the trace of.
Out[26]=  
The norm of an algebraic number a is the product of all roots of MinimalPolynomial[a]. This gives the norm of .
Out[27]=  
An algebraic number a is an algebraic unit iff both a and 1/a are algebraic integers, or equivalently, iff AlgebraicNumberNorm[a] is 1 or 1. This shows that GoldenRatio is an algebraic unit.
Out[28]=  
This shows that is not an algebraic unit.
Out[29]=  
An algebraic number a is a root of unity iff for some integer n. This shows that is a root of unity.
Out[30]=  
Functions for computing properties of elements of algebraic number fields. If a is Algebraic[f, coeffs, k], then NumberFieldCharacteristicPolynomial[a, x] is equal to , where d is the extension degree of (Root[f, k])/(a). NumberFieldCharacteristicPolynomial of , represented as an element of an extension of rationals of degree 4, is the square of MinimalPolynomial of .
Out[31]=  
NumberFieldTrace[a] is the sum of all roots of NumberFieldCharacteristicPolynomial[a]. If a is Algebraic[f, coeffs, k], then NumberFieldTrace[a] is equal to , where d is the extension degree of (Root[f, k])/(a). NumberFieldTrace of , represented as an element of an extension of rationals of degree 4, is twice the AlgebraicNumberTrace of .
Out[32]=  
Out[33]=  
NumberFieldNorm[a] is the product of all roots of NumberFieldCharacteristicPolynomial[a]. If a is Algebraic[f, coeffs, k], then NumberFieldNorm[a] is equal to , where d is the extension degree of (Root[f, k])/(a). NumberFieldNorm of , represented as an element of an extension of rationals of degree 4, is the square of AlgebraicNumberNorm of .
Out[34]=  
Out[35]=  
Functions of computing properties of algebraic number fields. An integral basis of an algebraic number field K is a list of algebraic numbers forming a basis of the module of algebraic integers of K. is an integral basis of an algebraic number field K iff K are algebraic integers, and every algebraic integer z K can be uniquely represented as
with integer coefficients . This gives an integral basis of the field generated by the first root of .
Out[36]=  
Here is an integral basis of ).
Out[37]=  
This gives the roots of unity in the field generated by the fourth root of .
Out[38]=  
Here are all roots of unity in the field ).
Out[39]=  
is a list of fundamental units of an algebraic number field K iff K are algebraic units, and every algebraic unit u K can be uniquely represented as
with a root of unity and integer exponents . Here is a set of fundamental units of the field generated by the third root of .
Out[40]=  
This gives a fundamental unit of the quadratic field ).
Out[41]=  
This gives a set of representatives of classes of elements of norm 9 in the field generated by the first root of .
Out[42]=  
Here is a set of representatives of classes of elements of norm 2 in the field ).
Out[43]=  
This shows that the polynomial has 1 real root and 2 conjugate pairs of complex roots.
Out[44]=  
This shows that the field ) has 12 real embeddings and 6 conjugate pairs of complex embeddings.
Out[45]=  
The discriminant of a number field K is the discriminant of an integral basis of K (i.e. the determinant of the matrix with elements ). The value of the determinant does not depend on the choice of integral basis. Here is the discriminant of ).
Out[46]=  
This gives the discriminant of the field generated by a root of the polynomial . The value of the discriminant does not depend on the choice of the root.
Out[47]=  
The regulator of a number field K is the lattice volume of the image of the group of units of K under the logarithmic embedding
where are the real embeddings of K in , and are one of each conjugate pair of the complex embeddings of K in . Here is the regulator of ).
Out[48]=  
This gives the regulator of the field generated by a root of the polynomial . The value of the regulator does not depend on the choice of the root.
Out[49]=  
