polyroot
Find the Roots of a Polynomial
Description
Finds all roots of a polynomial with real or complex coefficients.
Usage
polyroot(z)
Arguments
z |
a numeric or a complex vector containing the polynomial coefficients.
The ith component of z is the coefficient of x^(i-1).
|
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).
Value
returns a complex vector of length n-1
representing the roots of the polynomial.
References
Box, G. E. P. and Jenkins, G. M. 1976. Time Series Analysis: Forecasting and Control. Oakland, CA: Holden-Day.
Jenkins, M. A. and Traub, J. F. 1972. Zeros of a complex polynomial. Comm. ACM. Volume 15, 97--99.
Withers, D. H. 1974. Remark on algorithm 419, Comm. ACM. Volume 16, 157.
See Also
Examples
a <- c(0.5, .5, .3, .05) # 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.