The code below is given in Eric Weisstein's Math World article: Matrix Minimal Polynomial
.
MatrixMinimalPolynomial[a_List?MatrixQ,x_]:=Module[
{
i,
n=1,
qu={},
mnm={Flatten[IdentityMatrix[Length[a]]]}
},
While[Length[qu]==0,
AppendTo[mnm,Flatten[MatrixPower[a,n]]];
qu=NullSpace[Transpose[mnm]];
n++
];
First[qu].Table[x^i,{i,0,n-1}]
]
Is it possible to adapt the code to give the minimal polynomial of a matrix over a finite field of prime order $p$. Perhaps by adding Modulus -> p
in the argument for NullSpace
.
Modulus
argument toNullSpace
. What is your question? $\endgroup$