28.6 Miscellaneous Functions

: poly (A)
: poly (x)

If A is a square N-by-N matrix, poly (A) is the row vector of the coefficients of det (z * eye (N) - A), the characteristic polynomial of A.

For example, the following code finds the eigenvalues of A which are the roots of poly (A).

roots (poly (eye (3)))
    ⇒ 1.00001 + 0.00001i
       1.00001 - 0.00001i
       0.99999 + 0.00000i

In fact, all three eigenvalues are exactly 1 which emphasizes that for numerical performance the eig function should be used to compute eigenvalues.

If x is a vector, poly (x) is a vector of the coefficients of the polynomial whose roots are the elements of x. That is, if c is a polynomial, then the elements of d = roots (poly (c)) are contained in c. The vectors c and d are not identical, however, due to sorting and numerical errors.

See also: roots, eig.

: polyout (c)
: polyout (c, x)
: str = polyout (…)

Display a formatted version of the polynomial c.

The formatted polynomial

c(x) = c(1) * x^n + … + c(n) x + c(n+1)

is returned as a string or written to the screen if nargout is zero.

The second argument x specifies the variable name to use for each term and defaults to the string "s".

See also: polyreduce.

: polyreduce (c)

Reduce a polynomial coefficient vector to a minimum number of terms by stripping off any leading zeros.

See also: polyout.

© 1996–2020 John W. Eaton
Permission is granted to make and distribute verbatim copies of this manual provided the copyright notice and this permission notice are preserved on all copies.
Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided that the entire resulting derived work is distributed under the terms of a permission notice identical to this one.
Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions.
https://octave.org/doc/v6.3.0/Miscellaneous-Functions.html