For example, choose $p(X) = X^4 + X + 1$, how to construct addition and multiplication tables for $\mathbb{F}_{2}[X] \mod{X^4 + X + 1} $ ?
1 Answer
$\begingroup$
$\endgroup$
p = X^4 + X + 1;
mod[x_] := PolynomialMod[x, p, Modulus -> 2]
elements = mod[Plus @@@ Subsets[X^Range[0, 4]]]
And the tables are:
plustab = Outer[mod@*Plus, elements, elements];
timestab = Outer[mod@*Times, elements, elements];
If you prefer to identify the elements by their index in elements
, you can do
lookuptable = AssociationThread[elements, Range[Length[elements]]];
plustabidx = Lookup[lookuptable, #] & /@ plustab;
timestabidx = Lookup[lookuptable, #] & /@ timestab;