I need help, I'm working over the Galois Fields $\mathrm{GF}(2^m)$ and I will construct the field with a chosen irreducible polynomial of degree $m$ over $\mathrm{GF}(2)$. I can do it on GAP. Now comes my problem. I'll take $a$ to be a root of this polynomial and I need to find, for a fixed $c$ in $GF(2^m)$, an expression for $c$ in terms of the field $F[a]$ that I constructed. Is it possible to do it in GAP? And if it is, how can I do it? I know the basics of GAP.
(This is a follow-up to my question How to solve a quadratic equation over finite fields with GAP.. in which I asked for solutions to polynomial equations. I however need to say GAP what irreducible polynomial to take to construct the field.)
Basically you want to change coefficient between two bases. Your field has the basis $1,a,a^2,...$, GAP's field uses another basis, namely its own primitive element $b$. For example, for $p=2$ and polynomial $x^2+x-1$ and some (here randomly chosen) $c\in GF(7^2)$:
First calculate a basis for the field. We can for example calculate coefficients wrt this basis:
To get the base change, lets calculate $a$ and get coefficient vectors for $1,a,...$:
To express elements in terms of the $a$-basis we need the inverse matrix:
Now we use this inverse to convert the coeffiicients of $c$ wrt. GAP's basis to the $a$-basis. (Multiplication from the right, as GAP uses row vectors.)
(The last 4 lines verify the calculation. Indeed $c=3+6*a$.)
If you wanted to display finite field elements prettily in your basis, the following hack function (using polynomials over the integers) would do so:
and as the exaple shows you could even apply this function to lists of numbers.