Previous Up Next

6.34.18  Construction of a Galois field: GF

A Galois field is a finite field. A Galois field will have characteristic p for some prime number p, and the order will be pn for some integer n. Any Galois field of order pn will be isomorphic to ℤ/pℤ[X]/I, where I is the ideal generated by an irreducible polynomial P(X) in ℤ/pℤ[X]

The GF command creates Galois fields.

The elements of the field will be 0,g,g2,…,gpn−2.


Example.
Input:

GF(2,8)

Output:

GF(2,k8+k4+k3+k2+1,
k,K,g
,undef)

The field K has 28=256 elements and g generates the multiplicative group of this field ({1,g,g2,…,g254}).
The elements of this field can be written as polynomials in g or as K(P(k)), where P(k) is a polynomial in k. Input:

g^9

or: Input:

K(k^9)

or: Output:

(g5+g4+g3+g)

indeed g8=g4+g3+g2+1, so g9=g5+g4+g3+g.


Once a Galois field is created in Xcas, you can use elements of the field to create polynomials and matrices, and use the usual operators on them, such as +, -, *, /, ^, inv, sqrt, quo, rem, quorem, diff, factor, gcd, egcd, etc.


Examples.

There are still some limitations due to an incomplete implementation of some algorithms, such as multivariate factorization when the polynomial is not unitary.

Example:
Input:

G(x)^255

Output should be the unit, indeed:

GF(2,x^8-x^6-x^4-x^3-x^2-x-1,x,1)

As one can see in these examples, the output contains many times the same information that you would prefer not to see if you work many times with the same field. For this reason, the definition of a Galois field may have an optional argument, a variable name which will be used thereafter to represent elements of the field. Since you will also most likely want to modify the name of the indeterminate, the field name is grouped with the variable name in a list passed as third argument to GF. Note that these two variable names must be quoted.


Example.
Input:

G:=GF(2,2,[’w’,’G’]):; G(w^2)

Output:

Done, G(w+1)

Input:

G(w^3)

Output:

G(1)

Hence, the elements of GF(2,2) are G(0),G(1),G(w),G(w^2)=G(w+1).

We may also impose the irreducible primitive polynomial that we wish to use, by putting it as second argument (instead of n), for example:

G:=GF(2,w^8+w^6+w^3+w^2+1,['w','G'])

If the polynomial is not primitive, Xcas will replace it automatically by a primitive polynomial, for example:
Input:

G:=GF(2,w^8+w^7+w^5+w+1,['w','G'])

Output:

G:=GF(2,w^8-w^6-w^3-w^2-1,['w','G'],undef)

Previous Up Next