finite fields

The prime finite fields can be made easily as quotient rings of ZZ.

i1 : ZZ/101

      ZZ
o1 = ---
     101

o1 : QuotientRing

In general, to make a finite field with q elements, we use GF.

i2 : k = GF 81

o2 = k

o2 : GaloisField

The generator of the field can be obtained as usual.

i3 : k_0

o3 = $x

o3 : k

Notice that the name of the generator is displayed with a $ in it to indicate that it is not accessible by typing. Of course, you could assign the generator to the symbol of your choice, but it will still print the same way.

i4 : a = k_0

o4 = $x

o4 : k
i5 : a^20+1

       30
o5 = $x

o5 : k

To specify a name for the generator when the field is created, use the Variable option.

i6 : F = GF(16, Variable => b)

o6 = F

o6 : GaloisField
i7 : b^20 + 1

      10
o7 = b

o7 : F
i8 : random F

      10
o8 = b

o8 : F

Finite fields can be used as base rings for polynomial rings.

i9 : R = F[x,y,z]

o9 = R

o9 : PolynomialRing
i10 : random(2,R)

       13 2    11       11 2    10       5       2 2
o10 = b  x  + b  x*y + b  y  + b  x*z + b y*z + b z 

o10 : R

If you have a quotient ring that you know is a finite field, then you can convert it to ring which is known by the system to be a finite field.

i11 : GF (ZZ/2[T]/(T^9+T+1), Variable => T)

o11 = GF(512)

o11 : GaloisField

You may also provide your own choice of primitive element. Internally, elements of the finite field are stored as powers of the primitive element. First we assign our quotient ring to a global variable to ensure that T gets set to a value in the quotient ring, and then we call GF.

i12 : A = ZZ/2[T]/(T^9+T+1)

o12 = A

o12 : QuotientRing
i13 : k = GF (A, PrimitiveElement => T^3+1)

o13 = k

o13 : GaloisField

Notice that T is still recorded as an element of its quotient ring, rather than this finite field.

i14 : T

o14 = T

o14 : A

Use promote to see how the generator T appears as an element of the finite field.

i15 : promote(T,k)

        42
o15 = $x

o15 : k

Conversely, a given element of the finite field can be transferred back to the quotient ring with lift.

i16 : lift(k_0, ring T)

       3
o16 = T  + 1

o16 : A

We can even lift it back to the polynomial ring.

i17 : lift(k_0, ambient ring T)

       3
o17 = T  + 1

      ZZ
o17 : --[T]
       2


topindexpreviousupnext