ABSTRACT

Given a vector of roots r, poly(r) constructs the coefficients of the polynomial with those roots. With a little bit of roundoff error, you should see the original polynomial. Try it.

The poly function also computes the characteristic polynomial of a matrix whose roots are the eigenvalues of the matrix. The polynomial f(x) was chosen as the characteristic equation of the magic(3) matrix. Try:

A = magic(3) s = poly(A) roots(s) eig(A) f = poly(sym(A)) solve(f) eig(sym(A))

17.2 Evaluating polynomials You can evaluate a polynomial at one or more points with the polyval function.