Polynomial Roots
Computes the roots (and multiplicities) of a polynomial.
roots(p) polyroots(p, ntol = 1e-04, ztol = 1e-08) rootsmult(p, r, tol=1e-12)
p |
vector of real or complex numbers representing the polynomial. |
r |
a possible root of the polynomial. |
tol, ntol, ztol |
norm tolerance and accuracy for polyroots. |
The function roots
computes roots of a polynomial as eigenvalues
of the companion matrix.
polyroots
attempts to refine the results of roots
with special
attention to multiple roots. For a reference of this implementation see
F. C. Chang, "Solving multiple-root polynomials",
IEEE Antennas and Propagation Magazine Vol. 51, No. 6 (2010), pp. 151-155.
rootsmult
determines te order of a possible root r
. As this
computation is problematic in double precision, the result should be taken
with a grain of salt.
roots
returns a vector holding the roots of the polynomial,
rootsmult
the multiplicity of a root as an integer. And
polyroots
returns a data frame witha column 'root' and a column
'mult' giving the multiplicity of that root.
roots(c(1, 0, 1, 0, 0)) # 0 0 1i -1i p <- Poly(c(-2, -1, 0, 1, 2)) # 1*x^5 - 5*x^3 + 4*x roots(p) # 0 -2 2 -1 1 p <- Poly(c(rep(1, 4), rep(-1, 4), 0, 0)) # 1 0 -4 0 6 0 -4 0 1 rootsmult(p, 1.0); rootsmult(p, -1.0) # 4 4 polyroots(p) ## root mult ## 1 0 2 ## 2 1 4 ## 3 -1 4
Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.