Characteristic polynomial of matrix
charpoly(A)
charpoly(A,var)
charpoly(
returns
a vector of the coefficients of the characteristic polynomial of A
)A
.
If A
is a symbolic matrix, charpoly
returns
a symbolic vector. Otherwise, it returns a vector of doubleprecision
values.
charpoly(
returns
the characteristic polynomial of A
,var
)A
in terms of var
.

Matrix. 

Free symbolic variable. Default: If you do not specify 
Compute the characteristic polynomial of the matrix A
in
terms of the variable x
:
syms x A = sym([1 1 0; 0 1 0; 0 0 1]); charpoly(A, x)
ans = x^3  3*x^2 + 3*x  1
To find the coefficients of the characteristic polynomial of A
,
call charpoly
with one argument:
A = sym([1 1 0; 0 1 0; 0 0 1]); charpoly(A)
ans = [ 1, 3, 3, 1]
Find the coefficients of the characteristic polynomial of the
symbolic matrix A
. For this matrix, charpoly
returns
the symbolic vector of coefficients:
A = sym([1 2; 3 4]); P = charpoly(A)
P = [ 1, 5, 2]
Now find the coefficients of the characteristic polynomial of
the matrix B
, all elements of which are doubleprecision
values. Note that in this case charpoly
returns
coefficients as doubleprecision values:
B = ([1 2; 3 4]); P = charpoly(B)
P = 1 5 2
[1] Cohen, H. “A Course in Computational Algebraic Number Theory.” Graduate Texts in Mathematics (Axler, Sheldon and Ribet, Kenneth A., eds.). Vol. 138, Springer, 1993.
[2] Abdeljaoued, J. “The Berkowitz Algorithm, Maple and Computing the Characteristic Polynomial in an Arbitrary Commutative Ring.” MapleTech, Vol. 4, Number 3, pp 21–32, Birkhauser, 1997.