polychar#
Purpose#
Computes the characteristic polynomial of a square matrix.
Format#
- c = polychar(x)#
- Parameters:
x (NxN matrix) – data.
- Returns:
c ((N+1)x1 vector) –
coefficients of the Nth order characteristic polynomial of x:
\[p(x) = c[1]*x^n + c[2]*x^{(n-1)} + ... + c[n]*x + c[n+1];\]
Remarks#
The coefficient of \(x^n\) is set to unity (\(c[1]=1\)).
Examples#
x = { 2 1, 1 2 };
// Compute the characteristic polynomial
c = polychar(x);
print c;
The code above produces the following output:
1.0000000
-4.0000000
3.0000000
This represents the polynomial \(p(\lambda) = \lambda^2 - 4\lambda + 3\).
Source#
poly.src
See also
Functions polymake(), polymult(), polyroot(), polyeval()