Find the Roots of a Polynomial

DESCRIPTION:
Finds all roots of a polynomial with real or complex coefficients.

USAGE:
polyroot(z)

REQUIRED ARGUMENTS:
z:
numeric or complex vector containing the polynomial coefficients. The ith component of z is the coefficient of x^(i-1). The highest order coefficient should not be 0+i0, and length(z) should not be greater that 49.

VALUE:
the roots of the polynomial as a complex vector.

DETAILS:
The object is to find all solutions x of

z[i]*x^(i-1) + ... + z[2]*x + z[1] = 0.

The algorithm to do so is described in Jenkins and Traub (1972) with modifications from Withers (1974).


REFERENCES:
Box, G. E. P. and Jenkins, G. M. (1976). Time Series Analysis: Forecasting and Control. Holden-Day, Oakland, Calif.

Jenkins, M. A. and Traub, J. F. (1972). Zeros of a complex polynomial. Communications of the ACM 15, 97-99.

Withers, D. H. (1974). Remark on algorithm 419. Communications of the ACM 17, 157.


SEE ALSO:
uniroot

EXAMPLES:
a <- c(1.2, .5, .3, 1) # some AR coefficients

# Compute and plot the roots of the characteristic equation to # check for stationarity of the process (see Box and Jenkins, p. 55).

root <- polyroot(c(1, -a)) plot(root) symbols(0, 0, circles=1, add=T, inches=F, col=5) # All roots outside the unit circle, implies a stationary process.