[next][previous][up][top][index]
search for:

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 = $a

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 = $a

o4 : k
i5 : a^20+1

       30
o5 = $a

o5 : k

You may use ambient to see the quotient ring the field is made from.

i6 : ambient k

     ZZ
     -- [$a, MonomialSize => 16]
      3
o6 = ---------------------------
           4     3     2
         $a  + $a  + $a  + 1

o6 : QuotientRing

Use ideal to see the ideal that defined that quotient ring.

i7 : ideal oo

             4     3     2
o7 = ideal($a  + $a  + $a  + 1)

              ZZ
o7 : Ideal of -- [$a, MonomialSize => 16]
               3

Finally, you may use _ to recover the generator of the ideal.

i8 : oo_0

       4     3     2
o8 = $a  + $a  + $a  + 1

     ZZ
o8 : -- [$a, MonomialSize => 16]
      3

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

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

o9 = F

o9 : GaloisField
i10 : b^20 + 1

       10
o10 = b

o10 : F
i11 : random F

       10
o11 = b

o11 : F

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

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

o12 = R

o12 : PolynomialRing
i13 : random(2,R)

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

o13 : R

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

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

o14 = GF(512)

o14 : 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.

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

o15 = A

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

o16 = k

o16 : GaloisField

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

i17 : T

o17 = T

o17 : A

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

i18 : promote(T,k)

        42
o18 = $a

o18 : k

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

i19 : lift(k_0, ring T)

       3
o19 = T  + 1

o19 : A

We can even lift it back to the polynomial ring.

i20 : lift(k_0, ambient ring T)

       3
o20 = T  + 1

      ZZ
o20 : -- [T]
       2

For more information see GaloisField.


[next][previous][up][top][index]
search for: