# 13 Cyclotomics

GAP3 allows computations in abelian extension fields of the rational field Q, i.e., fields with abelian Galois group over Q. These fields are described in chapter Subfields of Cyclotomic Fields. They are subfields of cyclotomic fields Qn = Q(en) where en = e(2π i)/(n) is a primitive n--th root of unity. Their elements are called cyclotomics.

The internal representation of a cyclotomic does not refer to the smallest number field but the smallest cyclotomic field containing it (the so--called conductor). This is because it is easy to embed two cyclotomic fields in a larger one that contains both, i.e., there is a natural way to get the sum or the product of two arbitrary cyclotomics as element of a cyclotomic field. The disadvantage is that the arithmetical operations are too expensive to do arithmetics in number fields, e.g., calculations in a matrix ring over a number field. But it suffices to deal with irrationalities in character tables (see Character Tables). (And in fact, the comfortability of working with the natural embeddings is used there in many situations which did not actually afford it ...)

All functions that take a field extension as ---possibly optional--- argument, e.g., `Trace` or `Coefficients` (see chapter Fields), are described in chapter Subfields of Cyclotomic Fields.

the representation of cyclotomics in GAP3 (see More about Cyclotomics),
integral elements of number fields (see Cyclotomic Integers, IntCyc, RoundCyc),
characteristic functions (see IsCyc, IsCycInt),
comparison and arithmetical operations of cyclotomics (see Comparisons of Cyclotomics, Operations for Cyclotomics),
functions concerning Galois conjugacy of cyclotomics (see GaloisCyc, StarCyc), or lists of them (see GaloisMat, RationalizedMat),
some special cyclotomics, as defined in CCN85 (see ATLAS irrationalities, Quadratic)

The external functions are in the file `LIBNAME/"cyclotom.g"`.

### Subsections

Elements of number fields (see chapter Subfields of Cyclotomic Fields), cyclotomics for short, are arithmetical objects like rationals and finite field elements; they are not implemented as records ---like groups--- or e.g. with respect to a character table (although character tables may be the main interest for cyclotomic arithmetics).

`E( n )`

returns the primitive n-th root of unity en = e(2π i)/(n). Cyclotomics are usually entered as (and irrational cyclotomics are always displayed as) sums of roots of unity with rational coefficients. (For special cyclotomics, see ATLAS irrationalities.)

```    gap> E(9); E(9)^3; E(6); E(12) / 3;
-E(9)^4-E(9)^7    # the root needs not to be an element of the base
E(3)
-E(3)^2
-1/3*E(12)^7```

For the representation of cyclotomics one has to recall that the cyclotomic field Qn = Q(en) is a vector space of dimension φ(n) over the rationals where φ denotes Euler's phi-function (see Phi).

Note that the set of all n-th roots of unity is linearly dependent for n > 1, so multiplication is not the multiplication of the group ring Q⟨ en; given a Q-basis of Qn the result of the multiplication (computed as multiplication of polynomials in en, using (en)n = 1) will be converted to the base.

```    gap> E(5) * E(5)^2; ( E(5) + E(5)^4 ) * E(5)^2;
E(5)^3
E(5)+E(5)^3
gap> ( E(5) + E(5)^4 ) * E(5);
-E(5)-E(5)^3-E(5)^4```

Cyclotomics are always represented in the smallest cyclotomic field they are contained in. Together with the choice of a fixed base this means that two cyclotomics are equal if and only if they are equally represented.

Addition and multiplication of two cyclotomics represented in Qn and Qm, respectively, is computed in the smallest cyclotomic field containing both: Q`Lcm`(n,m). Conversely, if the result is contained in a smaller cyclotomic field the representation is reduced to the minimal such field.

The base, the base conversion and the reduction to the minimal cyclotomic field are described in Zum89, more about the base can be found in ZumbroichBase.

Since n must be a `short integer`, the maximal cyclotomic field implemented in GAP3 is not really the field Qab. The biggest allowed (though not very useful) n is 65535.

There is a global variable `Cyclotomics` in GAP3, a record that stands for the domain of all cyclotomics (see chapter Subfields of Cyclotomic Fields).

## 13.2 Cyclotomic Integers

A cyclotomic is called integral or cyclotomic integer if all coefficients of its minimal polynomial are integers. Since the base used is an integral base (see ZumbroichBase), the subring of cyclotomic integers in a cyclotomic field is formed by those cyclotomics which have not only rational but integral coefficients in their representation as sums of roots of unity. For example, square roots of integers are cyclotomic integers (see ATLAS irrationalities), any root of unity is a cyclotomic integer, character values are always cyclotomic integers, but all rationals which are not integers are not cyclotomic integers. (See IsCycInt)

```    gap> ER( 5 );                # The square root of 5 is a cyclotomic
E(5)-E(5)^2-E(5)^3+E(5)^4    # integer, it has integral coefficients.
gap> 1/2 * ER( 5 );          # This is not a cyclotomic integer, ...
1/2*E(5)-1/2*E(5)^2-1/2*E(5)^3+1/2*E(5)^4
gap> 1/2 * ER( 5 ) - 1/2;    # ... but this is one.
E(5)+E(5)^4```

## 13.3 IntCyc

`IntCyc( z )`

returns the cyclotomic integer (see Cyclotomic Integers) with Zumbroich base coefficients (see ZumbroichBase) ```List( zumb, x -> Int( x ) )``` where zumb is the vector of Zumbroich base coefficients of the cyclotomic z; see also RoundCyc.

```    gap> IntCyc( E(5)+1/2*E(5)^2 ); IntCyc( 2/3*E(7)+3/2*E(4) );
E(5)
E(4)```

## 13.4 RoundCyc

`RoundCyc( z )`

returns the cyclotomic integer (see Cyclotomic Integers) with Zumbroich base coefficients (see ZumbroichBase) ```List( zumb, x -> Int( x+1/2 ) )``` where zumb is the vector of Zumbroich base coefficients of the cyclotomic z; see also IntCyc.

```    gap> RoundCyc( E(5)+1/2*E(5)^2 ); RoundCyc( 2/3*E(7)+3/2*E(4) );
E(5)+E(5)^2
-2*E(28)^3+E(28)^4-2*E(28)^11-2*E(28)^15-2*E(28)^19-2*E(28)^23
-2*E(28)^27```

## 13.5 IsCyc

`IsCyc( obj )`

returns `true` if obj is a cyclotomic, and `false` otherwise. Will signal an error if obj is an unbound variable.

```    gap> IsCyc( 0 ); IsCyc( E(3) ); IsCyc( 1/2 * E(3) ); IsCyc( IsCyc );
true
true
true
false```

`IsCyc` is an internal function.

## 13.6 IsCycInt

`IsCycInt( obj )`

returns `true` if obj is a cyclotomic integer (see Cyclotomic Integers), `false` otherwise. Will signal an error if obj is an unbound variable.

```    gap> IsCycInt( 0 ); IsCycInt( E(3) ); IsCycInt( 1/2 * E(3) );
true
true
false```

`IsCycInt` is an internal function.

## 13.7 NofCyc

`NofCyc( z )`
`NofCyc( list )`

returns the smallest positive integer n for which the cyclotomic z is resp. for which all cyclotomics in the list list are contained in Qn = Q( e(2 π i)/(n) ) = Q( `E(n)` ).

```    gap> NofCyc( 0 ); NofCyc( E(10) ); NofCyc( E(12) );
1
5
12```

`NofCyc` is an internal function.

## 13.8 CoeffsCyc

`CoeffsCyc( z, n )`

If z is a cyclotomic which is contained in Qn, ```CoeffsCyc( z, n )``` returns a list cfs of length n where the entry at position i is the coefficient of `E(n)`i-1 in the internal representation of z as element of the cyclotomic field Qn (see More about Cyclotomics, ZumbroichBase): <z> = cfs + cfs `E(n)`1 + ... + cfs[n] `E(n)`n-1.

Note that all positions which do not belong to base elements of Qn contain zeroes.

```    gap> CoeffsCyc( E(5), 5 ); CoeffsCyc( E(5), 15 );
[ 0, 1, 0, 0, 0 ]
[ 0, 0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, 0, -1, 0 ]
gap> CoeffsCyc( 1+E(3), 9 ); CoeffsCyc( E(5), 7 );
[ 0, 0, 0, 0, 0, 0, -1, 0, 0 ]
Error, no representation of <z> in 7th roots of unity```

`CoeffsCyc` calls the internal function `COEFFSCYC`:

`COEFFSCYC( z )`

is equivalent to `CoeffsCyc( z, NofCyc( z ) )`, see NofCyc.

## 13.9 Comparisons of Cyclotomics

To compare cyclotomics, the operators `<`, `<=`, `=`, `>=`, `>` and `<>` can be used, the result will be `true` if the first operand is smaller, smaller or equal, equal, larger or equal, larger, or inequal, respectively, and `false` otherwise.

Cyclotomics are ordered as follows: The relation between rationals is as usual, and rationals are smaller than irrational cyclotomics. For two irrational cyclotomics z1, z2 which lie in different minimal cyclotomic fields, we have <z1> < z2 if and only if `NofCyc(z1)` < `NofCyc(z2)`); if `NofCyc(z1)` = `NofCyc(z2)`), that one is smaller that has the smaller coefficient vector, i.e., <z1> ≤ z2 if and only if `COEFFSCYC(z1)``COEFFSCYC(z2)`.

You can compare cyclotomics with objects of other types; all objects which are not cyclotomics are larger than cyclotomics.

```    gap> E(5) < E(6);     # the latter value lies in Q3
false
gap> E(3) < E(3)^2;    # both lie in Q3, so compare coefficients
false
gap> 3 < E(3); E(5) < E(7);
true
true
gap> E(728) < (1,2);
true```

## 13.10 Operations for Cyclotomics

The operators `+`, `-`, `*`, `/` are used for addition, subtraction, multiplication and division of two cyclotomics; note that division by 0 causes an error.

`+` and `-` can also be used as unary operators;

`^` is used for exponentiation of a cyclotomic with an integer; this is in general not equal to Galois conjugation.

```    gap> E(5) + E(3); (E(5) + E(5)^4) ^ 2; E(5) / E(3); E(5) * E(3);
-E(15)^2-2*E(15)^8-E(15)^11-E(15)^13-E(15)^14
-2*E(5)-E(5)^2-E(5)^3-2*E(5)^4
E(15)^13
E(15)^8```

## 13.11 GaloisCyc

`GaloisCyc( z, k )`

returns the cyclotomic obtained on raising the roots of unity in the representation of the cyclotomic z to the k-th power. If z is represented in the field Qn and k is a fixed integer relative prime to n, `GaloisCyc( ., k )` acts as a Galois automorphism of Qn (see GaloisGroup for Number Fields); to get Galois automorphisms as functions, use GaloisGroup `GaloisGroup`.

```    gap> GaloisCyc( E(5) + E(5)^4, 2 );
E(5)^2+E(5)^3
gap> GaloisCyc( E(5), -1 );           # the complex conjugate
E(5)^4
gap> GaloisCyc( E(5) + E(5)^4, -1 );  # this value is real
E(5)+E(5)^4
gap> GaloisCyc( E(15) + E(15)^4, 3 );
E(5)+E(5)^4```

`GaloisCyc` is an internal function.

## 13.12 Galois

`Galois( z, e )`

This function is a kind of generalized version of `GaloisCyc`. If z is a list it returns the list of `Galois(x,e)` for each element x of z. If z is a cyclotomic, if e is an integer it is equivalent to `GaloisCyc(z,e)` and if e is a Galois element it is equivalent to `z^e`. Finally, if z is a record with a `.operations` field, it returns

`z.operations.Galois(z,e)`. One such operations is predefined:
if z is a polynomial, it does `Galois(x,e)` on each coefficient of z.

```    gap> Galois(E(3),-1);
E(3)^2
gap> Galois(E(3),-1);
E(3)^2
gap> G:=GaloisGroup(CF(3));
Group( NFAutomorphism( CF(3) , 2 ) )
gap> E(3)^G.1;
E(3)^2
gap> Galois([E(3),E(5)],-1);
[ E(3)^2, E(5)^4 ]
gap> Galois(X(Cyclotomics)+E(3),-1);
X(Cyclotomics) + (E(3)^2)```

## 13.13 ATLAS irrationalities

`EB( N )`, `EC( N )`, ..., `EH( N )`,
`EI( N )`, `ER( N )`,
`EJ( N )`, `EK( N )`, `EL( N )`, `EM( N )`,
`EJ( N, d )`, `EK( N, d )`, `EL( N, d )`, `EM( N, d )`,
`ES( N )`, `ET( N )`, ..., `EY( N )`,
`ES( N, d )`, `ET( N, d )`, ..., `EY( N, d )`,
`NK( N, k, d )`

For N a positive integer, let z = `E(N)` = e2 π i / N. The following so-called atomic irrationalities (see CCN85, Chapter 7, Section 10) can be entered by functions (Note that the values are not necessary irrational.):

 `EB(N)` = bN = 1/2∑j=1N-1zj2 (N≡ 1 mod 2) `EC(N)` = cN = 1/3∑j=1N-1zj3 (N≡ 1 mod 3) `ED(N)` = dN = 1/4∑j=1N-1zj4 (N≡ 1 mod 4) `EE(N)` = eN = 1/5∑j=1N-1zj5 (N≡ 1 mod 5) `EF(N)` = fN = 1/6∑j=1N-1zj6 (N≡ 1 mod 6) `EG(N)` = gN = 1/7∑j=1N-1zj7 (N≡ 1 mod 7) `EH(N)` = hN = 1/8∑j=1N-1zj8 (N≡ 1 mod 8)

(Note that in cN, ..., hN, N must be a prime.)

 `ER(N)` = √N `EI(N)` = i √N = √-N

From a theorem of Gauss we know that

bN = {
 1/2(-1+√N) if N≡ 1 mod 4 1/2(-1+i√N) if N≡ -1 mod 4
. ,

so √N can be (and in fact is) computed from bN. If N is a negative integer then `ER(N) = EI(-N)`.

For given N, let nk = nk(N) be the first integer with multiplicative order exactly k modulo N, chosen in the order of preference

 1, -1, 2, -2, 3, -3, 4, -4, ... .

We have

 `EY(N)` = yn = z+zn (n = n2) `EX(N)` = xn = z+zn+zn2 (n=n3) `EW(N)` = wn = z+zn+zn2+zn3 (n=n4) `EV(N)` = vn = z+zn+zn2+zn3+zn4 (n=n5) `EU(N)` = un = z+zn+zn2+... +zn5 (n=n6) `ET(N)` = tn = z+zn+zn2+... +zn6 (n=n7) `ES(N)` = sn = z+zn+zn2+... +zn7 (n=n8)

 `EM(N)` = mn = z-zn (n=n2) `EL(N)` = ln = z-zn+zn2-zn3 (n=n4) `EK(N)` = kn = z-zn+... -zn5 (n=n6) `EJ(N)` = jn = z-zn+... -zn7 (n=n8)

Let nk(d) = nk(d)(N) be the d+1-th integer with multiplicative order exactly k modulo N, chosen in the order of preference defined above; we write nk=nk(0),nk=nk(1), nk'' = nk(2) and so on. These values can be computed as `NK(N,k,d)` = nk(d)(N); if there is no integer with the required multiplicative order, `NK` will return `false`.

The algebraic numbers

 yN′=yN(1),yN''=yN(2),..., xN′,xN'',..., jN′,jN'',...
are obtained on replacing nk in the above definitions by nk,nk'',...; they can be entered as

 `EY(N,d)` = yN(d) `EX(N,d)` = xN(d) ⋅ `EJ(N,d)` = jn(d)

```    gap> EW(16,3); EW(17,2); ER(3); EI(3); EY(5); EB(9);
0
E(17)+E(17)^4+E(17)^13+E(17)^16
-E(12)^7+E(12)^11
E(3)-E(3)^2
E(5)+E(5)^4
1```

## 13.14 StarCyc

`StarCyc( z )`

If z is an irrational element of a quadratic number field (i.e. if z is a quadratic irrationality), `StarCyc( z )` returns the unique Galois conjugate of z that is different from z; this is often called <z>* (see DisplayCharTable). Otherwise `false` is returned.

```    gap> StarCyc( EB(5) ); StarCyc( E(5) );
E(5)^2+E(5)^3
false```

`Quadratic( z )`

If z is a cyclotomic integer that is contained in a quadratic number field over the rationals, it can be written as <z> = ( a + b \sqrtn )/(d) with integers a, b, n and d, where d is either 1 or 2. In this case `Quadratic( z )` returns a record with fields `a`, `b`, `root`, `d` and `ATLAS` where the first four mean the integers mentioned above, and the last one is a string that is a (not necessarily shortest) representation of z by bm, im or rm for m = `\|root\|` (see ATLAS irrationalities).

If z is not a quadratic irrationality or not a cyclotomic integer, `false` is returned.

```    gap> Quadratic( EB(5) ); Quadratic( EB(27) );
rec(
a := -1,
b := 1,
root := 5,
d := 2,
ATLAS := "b5" )
rec(
a := -1,
b := 3,
root := -3,
d := 2,
ATLAS := "1+3b3" )
rec(
a := 0,
b := 0,
root := 1,
d := 1,
ATLAS := "0" )
false```

## 13.16 GaloisMat

`GaloisMat( mat )`

mat must be a matrix of cyclotomics (or possibly unknowns, see Unknown). The conjugate of a row in mat under a particular Galois automorphism is defined pointwise. If mat consists of full orbits under this action then the Galois group of its entries acts on mat as a permutation group, otherwise the orbits must be completed before.

`GaloisMat( mat )` returns a record with fields `mat`, `galoisfams` and `generators`:

`mat`:

a list with initial segment mat (not a copy of mat); the list consists of full orbits under the action of the Galois group of the entries of mat defined above. The last entries are those rows which had to be added to complete the orbits; so if they were already complete, mat and `mat` have identical entries.

`galoisfams`:

a list that has the same length as `mat`; its entries are either 1, 0, -1 or lists:
`galoisfams[i]` = 1 means that `mat[i]` consists of rationals, i.e. [ `mat[i]` ] forms an orbit.
`galoisfams[i]` =-1 means that `mat[i]` contains unknowns; in this case [ `mat[i]` ] is regarded as an orbit, too, even if `mat[i]` contains irrational entries.
If `galoisfams[i]` = [ l1, l2 ] is a list then `mat[i]` is the first element of its orbit in `mat`; l1 is the list of positions of rows which form the orbit, and l2 is the list of corresponding Galois automorphisms (as exponents, not as functions); so we have `mat`[ l1[j] ][k] = `GaloisCyc`( `mat`[i][k], l2[j] ).
`galoisfams[i]` = 0 means that `mat[i]` is an element of a nontrivial orbit but not the first element of it.

`generators`:

a list of permutations generating the permutation group corresponding to the action of the Galois group on the rows of `mat`.

Note that mat should be a set, i.e. no two rows should be equal. Otherwise only the first row of some equal rows is considered for the permutations, and a warning is printed.

```    gap> GaloisMat( [ [ E(3), E(4) ] ] );
rec(
mat := [ [ E(3), E(4) ], [ E(3), -E(4) ], [ E(3)^2, E(4) ],
[ E(3)^2, -E(4) ] ],
galoisfams := [ [ [ 1, 2, 3, 4 ], [ 1, 7, 5, 11 ] ], 0, 0, 0 ],
generators := [ (1,2)(3,4), (1,3)(2,4) ] )
gap> GaloisMat( [ [ 1, 1, 1 ], [ 1, E(3), E(3)^2 ] ] );
rec(
mat := [ [ 1, 1, 1 ], [ 1, E(3), E(3)^2 ], [ 1, E(3)^2, E(3) ] ],
galoisfams := [ 1, [ [ 2, 3 ], [ 1, 2 ] ], 0 ],
generators := [ (2,3) ] )```

## 13.17 RationalizedMat

`RationalizedMat( mat )`

returns the set of rationalized rows of mat, i.e. the set of sums over orbits under the action of the Galois group of the elements of mat (see GaloisMat).

This may be viewed as a kind of trace operation for the rows.

Note that mat should be a set, i.e. no two rows should be equal.

```    gap> mat:= CharTable( "A5" ).irreducibles;
[ [ 1, 1, 1, 1, 1 ], [ 3, -1, 0, -E(5)-E(5)^4, -E(5)^2-E(5)^3 ],
[ 3, -1, 0, -E(5)^2-E(5)^3, -E(5)-E(5)^4 ], [ 4, 0, 1, -1, -1 ],
[ 5, 1, -1, 0, 0 ] ]
gap> RationalizedMat( mat );
[ [ 1, 1, 1, 1, 1 ], [ 6, -2, 0, 1, 1 ], [ 4, 0, 1, -1, -1 ],
[ 5, 1, -1, 0, 0 ] ]```

gap3-jm
02 Dec 2021