Characteristic polynomial of a matrix
MuPAD® notebooks are not recommended. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
linalg::charpoly(A
, x
)
linalg::charpoly(A, x)
computes the characteristic
polynomial of the matrix A.
The characteristic polynomial of a n×n matrix
is defined by
,
where I_{n} denotes
the n×n identity
matrix.
The component ring of A
must be a commutative
ring, i.e., a domain of category Cat::CommutativeRing
.
We define a matrix over the rational numbers:
A := Dom::Matrix(Dom::Rational)([[1, 2], [3, 4]])
Then the characteristic polynomial p_{A}(x) is given by:
linalg::charpoly(A, x)
It is of the domain type:
domtype(%)
We define a matrix over ℤ_{7}:
B := Dom::Matrix(Dom::IntegerMod(7))([[1, 2], [3, 0]])
The characteristic polynomial p_{B}(x) of B
is
given by:
p := linalg::charpoly(B, x)
We compute the zeros of p_{B}(x),
i.e., the eigenvalues of the matrix B
:
solve(p)

A square matrix of a domain of category 

An identifier 
Polynomial of the domain Dom::DistributedPolynomial
([x],R)
,
where R
is the component ring of A
.
linalg::charpoly
implements Hessenberg's
algorithm to compute the characteristic polynomial of a square matrix A.
See: Henri Cohen: A Course in Computational Algebraic
Number Theory, GTM 138, Springer Verlag.
This algorithm works for any field and requires only O(n^{3}) field operations, in contrast to O(n^{4}) when computing the determinant of the characteristic matrix of A.
Since the size of the components of A in
intermediate computations of Hessenberg's algorithm can swell extremely,
it is only applied for matrices over Dom::Float
and Dom::IntegerMod
.
For any other component ring, the characteristic polynomial is computed using the Berkowitz algorithm.
Reference: Jounaidi Abdeljaoued, The Berkowitz Algorithm, Maple and Computing the Characteristic Polynomial in an Arbitrary Commutative Ring, MapleTech Vol 4 No 3, pp 2132, Birkhäuser, 1997.