[GAP Forum] Coefficients of basis elements for Galois field

Alexander Hulpke hulpke at me.com
Wed Feb 6 14:42:54 GMT 2013


Dear Forum,

On Feb 5, 2013, at 11:52 PM, Ha T. Lam <hatlam at gmail.com> wrote:

> I built a Galois field over F2 with irreducible polynomial f
> 
> x:=Indeterminate(GF(2), "x");
>> x
> f:=x^22+x^21+x^20+x^17+x^14+x^9+x^5+x+Z(2)^0;
>> x^22+x^21+x^20+x^17+x^14+x^9+x^5+x+Z(2)^0
> gf:=GF(2,f);
>> Field( [ a ] )
> BasisVectors(Basis(gf));
>> [ !Z(2)^0, a, a^2, a^3, a^4, a^5, a^6, a^7, a^8, a^9, a^10, a^11, a^12,
> a^13, a^14, a^15, a^16, a^17, a^18, a^19, a^20, a^21 ]
> 
> I'm trying to get the basis elements as polynomials, in particular, I want
> their coefficients, but I'm not sure how to do this. My guess is that since
> they are all powers of the primitive root, if I know the coefficients
> representing the primitive root, I will be able to compute their
> coefficients. The next thing I tried was to extract the primitive root:

This function is called PrimitiveElement in GAP:

gap> a:=PrimitiveElement(gf);
a

To see how elements of gf are represented as polynomials, you need to look at an elements internal representation:

gap> IsAlgBFRep(a^0); 
true
gap> IsAlgBFRep(a^1);
false

If it is in IsAlgBFRep (base field), then elm![1] (note the exclamation mark)returns the element of the base field:

gap> z:=a^0;
!Z(2)^0
gap> z![1];
Z(2)^0


If it is in IsAlgExtRep, z![1] returns the coefficient vector of the polynomial representing the element.
gap> z:=a^5+a+Z(2);
a^5+a+Z(2)^0
gap> IsAlgExtRep(z);  
true
gap> z![1];
<a GF2 vector of length 22>
gap> Print(z![1]);
[ Z(2)^0, Z(2)^0, 0*Z(2), 0*Z(2), 0*Z(2), Z(2)^0, 0*Z(2), 0*Z(2), 0*Z(2), 
0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2), 
0*Z(2), 0*Z(2), 0*Z(2), 0*Z(2) ]

I believe this is the data you were looking for.

Best wishes,

    Alexander Hulpke





More information about the Forum mailing list