# Dom::GaloisField

Finite fields

## Syntax

### Domain Creation

`Dom::GaloisField(`q`)`
`Dom::GaloisField(`p`, `n`)`
`Dom::GaloisField(`p`, `n`, `f`)`
`Dom::GaloisField(`F`, `n`)`
`Dom::GaloisField(`F`, `n`, `f`)`

### Element Creation

`Dom::GaloisField(p, n, f)(`g`)`

## Description

### Domain Creation

`Dom::GaloisField(p, n, f)` creates the residue class field , a finite field with pn elements. If `f` is not given, it is chosen at random among all irreducible polynomials of degree n.

`Dom::GaloisField(q)` (where q = pn) is equivalent to `Dom::GaloisField(p,n)`.

`Dom::GaloisField(F, n, f)` creates the residue class field F[X]/<f>, a finite field with |F|n elements.

If `f` is not given, a random irreducible polynomial of appropriate degree is used; some free identifier is chosen as its variable, and this one must also be used when creating domain elements.

Although n = 1 is allowed, `Dom::IntegerMod` should be used for representing prime fields.

If `F` is of type `Dom::GaloisField`, consisting of residue classes of polynomials, the variable of these polynomials must be distinct from the variable of `f`. If a tower several of Galois fields is constructed, the variable used in the uppermost Galois field must not equal any of those used in the tower. A special entry `"VariablesInUse"` serves to keep track of all variables appearing somewhere in the tower.

### Element Creation

`Dom::GaloisField(p,n,f)(g)` (or, respectively, `Dom::GaloisField(F,n,f)(g)`) creates the residue class of `g` modulo `f`. It is represented by the unique polynomial in that class that has smaller degree than `f`.

## Superdomain

`Dom::AlgebraicExtension``(``Dom::IntegerMod````(p), f)```

## Axioms

`Ax::canonicalRep`

## Categories

`Cat::Field`, `Cat::Algebra``(F)`, `Cat::VectorSpace``(F)`

## Examples

### Example 1

We define `L` to be the field with 4 elements. Then a4 = a for every aL, by a well-known theorem.

`L:=Dom::GaloisField(2, 2, u^2+u+1): L(u+1)^4`

## Parameters

 `q` Prime power `p` Prime `n` Positive integer `f` Univariate irreducible polynomial over `Dom::IntegerMod``(p)` or `F`, or polynomial expression convertible to such `F` Finite field of type `Dom::IntegerMod` or `Dom::GaloisField`. `g` Univariate polynomial over the ground field in the same variable as `f`, or polynomial expression convertible to such

## Entries

 "zero" the zero element of the field "one" the unit element of the field "characteristic" the characteristic of the field "size" the number of elements of the field "PrimeField" the prime field, which equals `Dom::IntegerMod``(p)`. "Variable" the variable of the polynomial `f`. "VariablesInUse" a list consisting of `"Variable"` and the variables used by the ground field.

expand all

## Mathematical Methods

### `iszero` — Test for zero

`iszero(a)`

It overloads the function `iszero`.

### `_power` — Integer power of an element

`_power(a, n)`

It overloads `_power`.

### `frobenius` — Frobeniu map

`frobenius(a)`

### `conjugates` — Conjugate of an element

`conjugates(a)`

### `order` — Order of an element

`order(a)`

### `isSquare` — Test whether an element is a square

`isSquare(a)`

### `ln` — Discrete logarithm

`ln(a, b)`

### `elementNumber` — Enumerate field elements

`elementNumber(a)`

The inverse of this mapping has not been implemented.

### `companionMatrix` — Companion matrix of the Galois field over its ground field

`companionMatrix()`

### `companionPowers` — Power of the companion matrix

`companionPowers()`

### `matrixRepresentation` — Isomorphism to the algebra generated by the companion matrix

`matrixRepresentation(a)`

If A is the companion matrix, the image of is .

### `randomPrimitive` — Choose a primitive element at random

`randomPrimitive()`

### `isBasis` — Test elements for being a basis over the ground field

`isBasis(l)`

### `isNormal` — Test whether a given field element is normal

`isNormal(a)`

### `randomNormal` — Choose normal element at random

`randomNormal()`

### `isPrimitivePolynomial` — Test whether a polynomial over the field is primitive

`isPrimitivePolynomial(h)`

## Conversion Methods

### `convert` — Conversion from other types

`convert(a)`

### `convert_to` — Conversion to other types

`convert_to(a, T)`