The minimalpoly command computes the minimal polynomial of a matrix A. The result is returned as a vector of coefficients in ascending order. An optional second argument P specifies a modulus for the computation.
minimalpoly([[1,2],[3,4]]); [-2, -5, 1] minimalpoly([[1,2],[3,4]],11); [9, 6, 1]