Conway polynomials
There is one field with elements, but many ways to write it down, one for each irreducible polynomial of degree mod . Conway polynomials are an agreed choice, made so that the fields for different fit inside one another in a fixed way. Computer algebra systems share tables of them; here they are computed from the definition.
The problem they solve
is built as for an irreducible of degree . Two people choosing different get isomorphic fields, but an element such as means different things to each, and there are isomorphisms to choose from. Worse, sits inside whenever divides , and working with several fields at once needs those inclusions to agree with each other.
The definition
The Conway polynomial is the monic polynomial of degree over that is
- primitive: its root generates the multiplicative group, so every non-zero element is a power of ;
- compatible: for every dividing , the power is a root of ;
- first among all such, in a particular order: write with alternating signs and compare the words , digits , as in a dictionary.
Condition 2 is what makes the embeddings fit: the standard generator of the small field is a fixed power of the standard generator of the big one. The alternating signs make with the smallest primitive root mod . The definition is recursive, and nothing shortcuts it: the search walks through candidates in order, testing primitivity (by the prime factors of ) and compatibility. That is quick for the fields one meets in practice and hopeless for large ones, which is why the published tables stop where they do.
import { conwayPolynomial, conwayField } from "@ratmath/structures";
conwayPolynomial(2, 8); // [1n, 0n, 1n, 1n, 1n, 0n, 0n, 0n, 1n], constant first: x⁸ + x⁴ + x³ + x² + 1
conwayPolynomial(3, 4); // x⁴ + 2x³ + 2
conwayPolynomial(5, 1); // x + 3, that is x − 2: 2 is the smallest primitive root mod 5
The polynomial for is not the one in the AES cipher (, which is irreducible but not primitive). The search reproduces the published values for every case tried in the tests, 23 of them.
The standard fields
conwayField(p, n) is the field built on that polynomial: the same kind of object as galoisField gives, plus its standard generator and the embeddings of the subfields.
const F = conwayField(2, 4); // GF(16) = GF(2)[a]/(a⁴ + a + 1)
F.text; // "x⁴ + x + 1"
F.order(F.gen); // 15n: a generates the whole multiplicative group
const e = F.embed(2); // GF(4) inside GF(16)
e.exponent; // 5: the generator of GF(4) is a⁵
F.format(e.image); // "a² + a", a root of x² + x + 1 = C(2,2)
Because every non-zero element is a power of , multiplication can be done by adding exponents, and F.log gives the exponent: the discrete logarithm, by table for fields this small.
@ratmath/structures and Core's Rational in scope. The last line's value is shown; PRINT(…) adds lines, TEX(…) typesets math.