@sym: charpoly (A) ¶@sym: charpoly (A, x) ¶Characteristic polynomial of symbolic matrix.
Numerical example:
A = sym([1 2; 3 4]);
mu = sym('mu');
charpoly (A, mu)
⇒ (sym)
2
μ - 5⋅μ - 2
We can then manipulate the characteristic polynomial, for example:
b(mu) = charpoly (A, mu)
⇒ b(mu) = (symfun)
2
μ - 5⋅μ - 2
b(1)
⇒ (sym) -6
We can also confirm that the characteristic polynomial is zero at an eigenvalue:
ev = eig(A); simplify(b(ev(1))) ⇒ (sym) 0
The matrix can contain symbols:
syms x
charpoly ([x x;1 x], sym('lambda'))
⇒ (sym)
2 2
λ - 2⋅λ⋅x + x - x
If x is omitted, the polynomial coefficients are returned:
charpoly (sym([4 1;3 9])) ⇒ ans = (sym) [1 -13 33] (1×3 matrix)
See also: @@sym/eig, @@sym/jordan.
Package: symbolic