# 2. Start Up and Declareations

In the Mathematica session, When you write

```<<GaloisField.m

```
then the Galois field package is ready to use. Next, you have to declare a Galois field which you want to use.

There are four types of declarations for finite fields in this package depending on different constructions of finite fields.

I . Prime fields
II . Extension fields over a prime base field. (needs a Galois field object)
III . Extension fields over a declared base field. (needs a Galois field object)
IV . Extension fields over a declared base field. (no objects needed )
When we declare a finite field of type II or III, the object of the finite field must exist as a file; it is called a Galois field object. A Galois field object can be created in precomputation and saved as a file.

## Type I

After loading the Galois Field Package by inputting <<GaloisField.m, we declare a finite field with the function DeclareGaloisField.
```DeclareGaloisField[K5,5]

K5 was declared.
Order is 5
Characteristic is 5
```
This example declares a prime field of order 5, GF(5). Then we can use the algebra name K5 and constants K5[i] for i=0,1,...,4.
```K5[3] + K5[4]
K5[2]
```

## Type II and III

When you declare a type II or III finite field, just use the function DeclareGaloisField
```DeclareGaloisField[GF16]

GF16 was declared.
Order is 16
Characteristic is 2
Irreducible Polynomial is {1, 1, 0, 0, 1}
Base Field is GF2
Extension Degree is 4
GF2 was declared.
Order is 2
Characteristic is 2
```
If the object GF16 does not exist, you get the following message:

Galois field object, GF16, does not exist.

Then you can make a type II object with the following function:

```MakeGaloisField[GF16,2,4,{1,1,0,0,1}]
```
The first argument is the name of the object (also used as algebra name), the second is the order of the base field (must be a prime number), the third is the extension degree and the fourth argument is the coefficient list of a primitive irreducible polynomial over the base field. The function saves the object as a file with the name of the first argument.

When you make a type III object, the second argument of MakeGaloisField must be an algebra name of the base field.

```MakeGaloisField[F16,GF4,2,{2,2,1}]
```
Of course, the base field must be declared before executing this function. The base field for type III dose not have to be a prime field.

## Type IV

Type IV Galois fields do not require objects for them. If a base field has been declared, then you can declare a type IV Galois field directly by the function DeclareGaloisField.
```DeclareGaloisField[K16,GF4,2,{2,2,1}]