|MATLAB Function Reference|
Polynomial with specified roots
p = poly(A)
A is an
n matrix returns an
n+1 element row vector whose elements are the coefficients of the characteristic polynomial, . The coefficients are ordered in descending powers: if a vector
n+1 components, the polynomial it represents is
p = poly(r)
r is a vector returns a row vector whose elements are the coefficients of the polynomial whose roots are the elements of
Note the relationship of this command to
which returns a column vector whose elements are the roots of the polynomial specified by the coefficients row vector
p. For vectors,
poly are inverse functions of each other, up to ordering, scaling, and roundoff error.
MATLAB displays polynomials as row vectors containing the coefficients ordered by descending powers. The characteristic equation of the matrix
is returned in a row vector by
The roots of this polynomial (eigenvalues of matrix
A) are returned in a column vector by
The algorithms employed for
roots illustrate an interesting aspect of the modern approach to eigenvalue computation.
poly(A) generates the characteristic polynomial of
roots(poly(A)) finds the roots of that polynomial, which are the eigenvalues of
A. But both
eig, which is based on similarity transformations. The classical approach, which characterizes eigenvalues as roots of the characteristic polynomial, is actually reversed.
A is an
poly(A) produces the coefficients
The algorithm is
This recursion is easily derived by expanding the product.
It is possible to prove that
poly(A) produces the coefficients in the characteristic polynomial of a matrix within roundoff error of
A. This is true even if the eigenvalues of
A are badly conditioned. The traditional algorithms for obtaining the characteristic polynomial, which do not use the eigenvalues, do not have such satisfactory numerical properties.