Previous Up Next

2.46.6  Characteristic polynomial : charpoly

charpoly (or pcar) takes one or two argument(s), a square matrix A of size n and optionnally the name of a symbolic variable.
charpoly returns the characteristic polynomial P of A written as the list of its coefficients if no variable name was provided or written as an expression with respect to the variable name provided as second argument.
The characteristic polynomial P of A is defined as

P(x)=det(x.IA

Input :

charpoly([[4,1,-2],[1,2,-1],[2,1,0]])

Output :

[1,-6,12,-8]

Hence, the characteristic polynomial of this matrix is x3−6x2+12x−8 (input normal(poly2symb([1,-6,12,-8],x)) to get its symbolic representation).
Input :

purge(X):; charpoly([[4,1,-2],[1,2,-1],[2,1,0]],X)

Output :

X^3-6*X^2+12*X-8

Previous Up Next