Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

roots

Roots of a polynomial


Description

Roots of a polynomial

Usage

roots(x, method = c("polyroot", "eigen"))

Arguments

x

Polynomial coefficients with coefficients given in order from highest to lowest polynomial power. This is the Matlab/Octave convention; it is opposite of the convention used by polyroot.

method

Either “polyroot” (default) which uses polyroot for its computations internally (and is typically more accurate) or “eigen” which uses eigenvalues of the companion matrix for its computation. The latter returns complex values in case of real valued solutions in less cases.

Value

A complex array with the roots of the polynomial.

Author(s)

Original Octave version by Kurt Hornik. Conversion to R by Tom Short.

References

Octave Forge http://octave.sf.net

See Also

Examples

roots(1:3)
polyroot(3:1) # should be the same
poly(roots(1:3))

roots(1:3, method="eigen") # using eigenvalues

signal

Signal Processing

v0.7-6
GPL-2
Authors
Uwe Ligges [aut, cre] (new maintainer), Tom Short [aut] (port to R), Paul Kienzle [aut] (majority of the original sources), Sarah Schnackenberg [ctb] (various test cases and bug fixes), David Billinghurst [ctb], Hans-Werner Borchers [ctb], Andre Carezia [ctb], Pascal Dupuis [ctb], John W. Eaton [ctb], E. Farhi [ctb], Kai Habel [ctb], Kurt Hornik [ctb], Sebastian Krey [ctb], Bill Lash [ctb], Friedrich Leisch [ctb], Olaf Mersmann [ctb], Paulo Neis [ctb], Jaakko Ruohio [ctb], Julius O. Smith III [ctb], Doug Stewart [ctb], Andreas Weingessel [ctb]
Initial release
2015-07-29

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.