MAGMA knows about all the finite fields.
To create the finite field
in MAGMA, type
F:=GF(p); . For example,
F:=GF(5); Set(F); returns
{ 0, 1, 2, 3, 4 } .
Addition is carried out using
and
multiplication using
.
The command GF returns a field for any
prime power
. MAGMA assigns a fixed
primitive element to each field
.
This is a root of a Conway
polynomial, which is the primitive polynomial
over
defining
.
If you don't want to use a root of the Conway polynomial
as a generator, one can also specify some other
polynomial.
To define the field of 3 elements, type
F3 := FiniteField(3);We can define the field of
> F<z> := FiniteField(3^4); > F; Finite field of size 3^4 > DefiningPolynomial(F); $.1^4 + 2*$.1^3 + 2
We can define it as an extension of the field of 3 elements, using the Conway polynomial:
> F<z> := ext< F3 | 4 >; > F; Finite field of size 3^4
We can supply our own polynomial, say
:
> P<x> := PolynomialRing(F3); > p:=x^4+x^3+2; > IsIrreducible(p); true > F<z> := ext< F3 | p >; > F; Finite field of size 3^4
We can define it as an extension of the field of
elements:
> F9<w> := ext< F3 | 2 >; > F<z> := ext< F9 | 2 >; > F; Finite field of size 3^4
Each element
is a polynomial of degree at most 3
in the primitive element
:
Eltseq command:
> w:=PrimitiveElement(F); > > a:=Random(F); > a; z^9 > Eltseq(a); [ 0, 2, 1, 1 ] > 2*w+w^2+w^3; //check z^9 > > a:=Random(F); > a; z^37 > Eltseq(a); [ 1, 2, 0, 0 ] > 1+2*w; //check z^37