求解n阶方阵零化多项式的mathematica代码

    技术2022-07-10  103

    Remove["`*"]; zeroPolynomial[A_] := Module[{n = Length[A], base, m, s}, base = NestList[Dot[A, #] &, IdentityMatrix[n], n^2]; m = Transpose[Flatten /@ base]; s = NullSpace[m][[1]]; Total[Table[x^i*s[[i]], {i, Length[s]}]] ]
    Processed: 0.034, SQL: 9