GF - Maple Help

Overview of the GF (Galois Field) Package

 Calling Sequence GF(p, k, a)

Parameters

 p - prime integer k - positive integer a - (optional) irreducible polynomial of degree k over the integers mod p

Description

 • The GF command returns a module G of procedures and constants for doing arithmetic in the finite field GF(p^k), a Galois Field with ${p}^{k}$ elements. The field GF(p^k) is defined by the field extension GF(p)[x]/(a) where a is an irreducible polynomial of degree k over the integers mod p.
 • If a is not specified, an irreducible polynomial of degree k over the integers mod p is chosen at random.  It can be accessed as the constant G:-extension.  The elements of GF(p^k) are represented using the $\mathrm{modp1}$ representation.
 • First, you need to define an instance of a Galois field using, for example, G := GF(2, 3). This defines all operations for G, the field of characteristic 2 with 8 elements.
 • The G:-input and G:-output commands convert from an integer in the range $0..{p}^{k}-1$ to the corresponding polynomial and back. Alternatively, G:-ConvertIn and G:-ConvertOut convert an element from GF(p^k) to a Maple sum of products, a univariate polynomial where the variable used is that given in the argument a. Otherwise the name ? is used. The syntax G(...) can be used instead of G:-ConvertIn(...).
 • Arithmetic in the field is defined by the following functions.

$G:-+,G:--,G:-,G:-^,G:-\mathrm{inverse},G:-/$

 • Field arithmetic can be written very naturally by using a use statement; see the examples below.
 • The additive and multiplicative identities are given by G:-zero and G:-one.
 • The G:-trace, G:-norm, and G:-order commands compute the trace, norm and multiplicative order of an element from GF(p^k) respectively.
 • The G:-random command returns a random element from GF(p^k).
 • The G:-PrimitiveElement command generates a primitive element at random.
 • The G:-isPrimitiveElement command tests whether an element from GF(p^k) is a primitive element, being a generator for the multiplicative group GF(p^k) - {0}.
 • For backwards compatibility, exports of the module returned by the GF command can also be accessed by indexed notation, such as G[':-ConvertIn']. However, using the more modern form G:-ConvertIn, you do not need to quote the name to avoid evaluation.

Examples

 > $\mathrm{G16}≔\mathrm{GF}\left(2,4,{\mathrm{\alpha }}^{4}+\mathrm{\alpha }+1\right):$
 > $a≔\mathrm{G16}:-\mathrm{ConvertIn}\left(\mathrm{\alpha }\right)$
 ${a}{≔}{\mathrm{\alpha }}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}$ (1)
 > $a≔\mathrm{G16}\left(\mathrm{\alpha }\right)$
 ${a}{≔}{\mathrm{\alpha }}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}$ (2)
 > $\mathrm{G16}:-\mathrm{*}\left(a,a\right)$
 ${{\mathrm{\alpha }}}^{{2}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}$ (3)
 > $\mathrm{G16}:-\mathrm{^}\left(a,4\right)$
 $\left({\mathrm{\alpha }}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}$ (4)
 > $x≔\mathrm{G16}:-\mathrm{^}\left(a,8\right)$
 ${x}{≔}\left({{\mathrm{\alpha }}}^{{2}}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}$ (5)
 > $\mathrm{G16}:-\mathrm{output}\left(x\right)$
 ${5}$ (6)
 > $\mathrm{G16}:-\mathrm{ConvertOut}\left(x\right)$
 ${{\mathrm{\alpha }}}^{{2}}{+}{1}$ (7)
 > $\mathrm{G16}:-\mathrm{isPrimitiveElement}\left(a\right)$
 ${\mathrm{true}}$ (8)
 > $x≔\mathrm{G16}:-\mathrm{^}\left(a,-1\right)$
 ${x}{≔}\left({{\mathrm{\alpha }}}^{{3}}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}$ (9)
 > $\mathrm{G16}:-\mathrm{*}\left(a,x\right)$
 ${1}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}$ (10)

The use statement, if used carefully, can make arithmetic operations in the field much more natural.

 > use G16 in   y := a * ( a + x );   z := a - y;   z^3 + y^2 end use;
 $\left({\mathrm{\alpha }}{+}{1}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{\mathbf{mod}}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}{2}$ (11)

Compatibility

 • The G(...) syntax for constructing field elements was introduced in Maple 2021.