| MeatAxe 2.4 | 
zcp Options [-Gfm] Matrix
This program reads in a square matrix and calculates its characteristic or minimal polynomial. With no options, the characteristic polynomial is computed in a partially factored form (see below). With "-m" the polynomial is split into irreducible factors. Without "-G", the output is in text format. Each line contains one factor of the characteristic or minimal polynomial. The "-G" option may be used to generate output which is readable by the GAP computer program. The output, then, is a sequence of sequences of finite field elements, representing the coefficients of the factors in ascending order.
The characteristic polynomial of a matrix A is computed by constructing a sequence
![\[ 0=U_0<U_1<\ldots<U_n=V \]](form_7.png) 
 of A-invariant subspaces, where  is A-cyclic. In the i-th step,
 is A-cyclic. In the i-th step,  is constructed by chosing a random vector
 is constructed by chosing a random vector  and calculating
 and calculating  until some linear combination of these vectors falls into
 until some linear combination of these vectors falls into  . This yields a polynomial
. This yields a polynomial  with
 with  .
.  is the characteristic polynomial of
 is the characteristic polynomial of  on
 on  , and the full characteristic polynomial of
, and the full characteristic polynomial of  is the product of all
 is the product of all  's.
's.
The algorithm for the minimal polynomial uses the same technique of constructing a sequence  of invariant subspaces. In the i-th step, images
 of invariant subspaces. In the i-th step, images  of a seed vector
 of a seed vector  are calculated, until a linear combination of these vectors vanishes (this is the main difference to the algorithm above). This yields a polynomial
 are calculated, until a linear combination of these vectors vanishes (this is the main difference to the algorithm above). This yields a polynomial  of minimal degree with
 of minimal degree with  , and the minimal polynomial of A is the least common multiple of the
, and the minimal polynomial of A is the least common multiple of the  's.
's.