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 number—an 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.
In[1]:=
If f is a monic irreducible polynomial function of degree l with integer coefficients, and are rational numbers, then is an inert numeric object.
In[2]:=
Out[2]=
N can be used to find a numeric approximation of an Algebraic object.
In[3]:=
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.
In[4]:=
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].
In[5]:=
Out[5]=
Algebraic objects representing rational numbers reduce automatically to numbers.
In[6]:=
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.
In[7]:=
Out[9]=
RootReduce transforms Algebraic objects to Root objects.
In[10]:=
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.
In[11]:=
Out[11]=
This represents as an element of the field generated by Root[4].
In[12]:=
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}.
In[13]:=
A direct computation of the value of f at {a, b, c} using RootReduce takes a rather long time.
In[15]:=
Out[15]=
A faster alternative is to do the computation in a common algebraic number field containing {a, b, c}.
In[16]:=
Out[16]=
Arithmetic within the common number field is much faster.
In[17]:=
Out[17]=
Converting the resulting Algebraic object to a Root object is fast as well.
In[18]:=
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]).
In[19]:=
Out[19]=
Setting SmallestField > True makes ToCommonField find the smallest field possible.
In[20]:=
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.
In[21]:=
Out[21]=
This gives the minimal polynomial of expressed as a polynomial in x.
In[22]:=
Out[22]=
An algebraic number is an algebraic integer iff its MinimalPolynomial is monic.
This shows that is an algebraic integer.
In[23]:=
Out[23]=
This shows that is not an algebraic integer.
In[24]:=
Out[24]=
This gives the smallest positive integer n for which n is an algebraic integer.
In[25]:=
Out[25]=
The trace of an algebraic number a is the sum of all roots of MinimalPolynomial[a].
This gives the trace of.
In[26]:=
Out[26]=
The norm of an algebraic number a is the product of all roots of MinimalPolynomial[a].
This gives the norm of .
In[27]:=
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.
In[28]:=
Out[28]=
This shows that is not an algebraic unit.
In[29]:=
Out[29]=
An algebraic number a is a root of unity iff for some integer n.
This shows that is a root of unity.
In[30]:=
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 .
In[31]:=
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 .
In[32]:=
Out[32]=
In[33]:=
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 .
In[34]:=
Out[34]=
In[35]:=
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 .
In[36]:=
Out[36]=
Here is an integral basis of ).
In[37]:=
Out[37]=
This gives the roots of unity in the field generated by the fourth root of .
In[38]:=
Out[38]=
Here are all roots of unity in the field ).
In[39]:=
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 .
In[40]:=
Out[40]=
This gives a fundamental unit of the quadratic field ).
In[41]:=
Out[41]=
This gives a set of representatives of classes of elements of norm 9 in the field generated by the first root of .
In[42]:=
Out[42]=
Here is a set of representatives of classes of elements of norm 2 in the field ).
In[43]:=
Out[43]=
This shows that the polynomial has 1 real root and 2 conjugate pairs of complex roots.
In[44]:=
Out[44]=
This shows that the field ) has 12 real embeddings and 6 conjugate pairs of complex embeddings.
In[45]:=
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 ).
In[46]:=
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.
In[47]:=
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 ).
In[48]:=
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.
In[49]:=
Out[49]=
