Skip to main content
Became Hot Network Question
Added link and put code into code block
Source Link
Bob Hanlon
  • 162.7k
  • 7
  • 81
  • 205

The code below is given in Eric Weisstein's Math World article: Matrix Minimal PolynomialMatrix 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}] ]

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 -> pModulus -> p in the argument for NullSpaceNullSpace.

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.

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.

Source Link
geoffrey
  • 877
  • 4
  • 7

Find the minimal polynomial for a matrix over a finite field

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.