This hopefully will get you started. It asks for the polynomial order, generate random integers from 1
to 10
for the coefficients of the polynomial, then uses FromDigits
to build the polynomial in x. It also asks for the Mod
integer value to use. It then calls PolynomialMod
and shows the original polynomial and the polynomial mod the integer.
Not pretty, just a quick hack. Just to first see if this is what you want before going more.
Manipulate[
doit;
Module[{p, m},
p = makePolynomial[n, x];
m = PolynomialMod[p, mod];
Grid[{
{"polynomial", Expand[p]},
{Row[{"polynomial mod ", mod}], m}
}, Alignment -> Left, Frame -> All]
],
{{n, 2, "polynomial order"}, 2, 10, 1, Appearance -> "Labeled"},
{{mod, 2, "mod"}, 1, 10, 1, Appearance -> "Labeled"},
Button["make another", doit = Date[], ImageSize -> 100],
ContentSize -> {550, 80},
Initialization :>
(
makePolynomial[n_Integer, x_Symbol] := Module[{z, c},
z = RandomChoice[{-1, 1}] RandomInteger[{1, 10}];
c = Table[RandomInteger[{-10, 10}], {n}];
FromDigits[Reverse[AppendTo[c, z]], x]
]
)
]
