polyroot {base} | R Documentation |
Find Zeros of a Real or Complex Polynomial
Description
Find zeros of a real or complex polynomial.
Usage
polyroot(z)
Arguments
z |
the vector of polynomial coefficients in decreasing order. |
Details
A polynomial of degree n - 1
,
p(x) = z_1 + z_2 x + \cdots + z_n x^{n-1}
is given by its coefficient vector z[1:n]
.
polyroot
returns the n-1
complex zeros of p(x)
using the Jenkins-Traub algorithm.
Value
A complex vector of length n - 1
, where n
is
length(z)
.
References
Jenkins and Traub (1972) TOMS Algorithm 419. Comm. ACM, 15, 97–99.
See Also
uniroot
for numerical root finding of arbitrary
functions;
complex
and the zero
example in the demos
directory.
Examples
polyroot(c(1, 2, 1))
round(polyroot(choose(8, 0:8)), 11) # guess what!
for (n1 in 1:4) print(polyroot(1:n1), digits = 4)