Two basic finite fields are:

This creates the ring of characteristic 3, having 3^4 = 81 elements. The elements of this ring are 0, a, a^2, a^3, ..., a^80.

Use ambient to see the quotient ring the field is made from.

Now check that `a` satisfies this equation.

It is often preferable to view elements of `F` as polynomials in `a` rather than as powers of `a`. This can be accomplished by lifting the elements back to this ambient ring.

(for more details on lift, see working with multiple rings).

GrÃ¶bner bases, and all related computations work in these rings.

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

The generator of the field can be obtained as usual.

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

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

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

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

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

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.

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`.

Notice that `T` is now recorded as an element of this finite field.

The generator of A can be obtained this way:

Use substitute to map it to an element of the finite field.

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

We can even lift it back to the polynomial ring.

For more information see GaloisField.

- ZZ/p
`GF(p^n)`

i1 : F = GF(81,Variable=>a) o1 = F o1 : GaloisField |

i2 : a^80 o2 = 1 o2 : F |

i3 : a^40 o3 = -1 o3 : F |

i4 : ambient F ZZ --[a] 3 o4 = ----------- 4 3 a - a - 1 o4 : QuotientRing |

i5 : a^4 + a - 1 3 o5 = a + a o5 : F |

i6 : lift(a^20, ambient F) 3 2 o6 = - a - a - 1 ZZ --[a] 3 o6 : ----------- 4 3 a - a - 1 |

i7 : apply({20,40,80}, i -> lift(a^i, ambient F)) 3 2 o7 = {- a - a - 1, -1, 1} o7 : List |

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

i8 : R = F[x,y,z] o8 = R o8 : PolynomialRing |

i9 : f = random(2,R) 3 2 2 2 3 2 3 3 o9 = (- a + a + a)x + (- a + 1)x*y + (a - a + 1)y + (a - 1)x*z + (- a ------------------------------------------------------------------------ 3 2 - a)y*z + (- a - a)z o9 : R |

i10 : f = (leadCoefficient f)^(-1) * f 2 2 2 3 2 3 2 o10 = x - a*x*y + (- a - a + 1)y + (a - a - a - 1)x*z + (a + a + a)y*z ----------------------------------------------------------------------- 3 2 2 + (a + a + a)z o10 : R |

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

i11 : ZZ/101 ZZ o11 = --- 101 o11 : QuotientRing |

i12 : k = GF 81 o12 = k o12 : GaloisField |

i13 : k_0 o13 = a o13 : k |

i14 : ambient k ZZ --[a] 3 o14 = ----------- 4 3 a - a - 1 o14 : QuotientRing |

i15 : ideal oo 4 3 o15 = ideal(a - a - 1) ZZ o15 : Ideal of --[a] 3 |

i16 : oo_0 4 3 o16 = a - a - 1 ZZ o16 : --[a] 3 |

i17 : F = GF(16, Variable => b) o17 = F o17 : GaloisField |

i18 : b^20 + 1 2 o18 = b + b + 1 o18 : F |

i19 : random F 3 o19 = b + b + 1 o19 : F |

i20 : R = F[x,y,z] o20 = R o20 : PolynomialRing |

i21 : random(2,R) 3 2 2 2 2 3 2 2 o21 = (b + b + b)x + (b + 1)x*y + y + (b + b + 1)x*z + (b + 1)y*z + ----------------------------------------------------------------------- 3 2 2 (b + b + 1)z o21 : R |

i22 : GF (ZZ/2[T]/(T^9+T+1), Variable => T) o22 = GF 512 o22 : GaloisField |

i23 : A = ZZ/2[T]/(T^9+T+1) o23 = A o23 : QuotientRing |

i24 : k = GF (A, PrimitiveElement => T^3+1) o24 = k o24 : GaloisField |

i25 : T o25 = T o25 : k |

i26 : A_0 o26 = T o26 : A |

i27 : substitute(A_0,k) o27 = T o27 : k |

i28 : lift(k_0, ring T) o28 = T o28 : k |

i29 : lift(k_0, ambient ring T) o29 = T o29 : A |