NRoots

NRoots[lhs==rhs,var]

yields a disjunction of equations which represent numerical approximations to the roots of a polynomial equation.

Details and Options

Examples

open allclose all

Basic Examples  (1)

Numerically find the roots of a polynomial:

Change the result to rules:

Test the roots:

Scope  (1)

Find the numerical roots of a polynomial with only real roots:

Find the numerical roots of a polynomial with real and complex roots:

Find the numerical roots of a polynomial with multiple roots:

Options  (5)

Method  (3)

Use the "Aberth" method, which simultaneously approximates all the roots of a univariate polynomial and converges cubically in general (but linearly at multiple zeros):

Use the "CompanionMatrix" method:

Use the "JenkinsTraub" method, which is a standard fast iterative globally convergent root-finding algorithm for polynomials:

PrecisionGoal  (1)

Specifying PrecisionGoal can improve the precision of the roots returned:

Use default precision:

Specify larger precisions:

Compare with the digits from an exact computation:

StepMonitor  (1)

Monitor the root-finding steps:


Using a different Method gives different convergence:

Applications  (1)

Visualize the asymptotic rate of growth of the terms in the "look and say sequence," which is given by the positive real root of the following polynomial:

Find the roots numerically:

Visualize the roots in the complex plane, highlighting the unique positive one:

Properties & Relations  (7)

Return numerical roots using NRoots:

Compare with the numericization of roots returned by Roots:

Compare with the numerical roots returned by NSolve:

Compare with the numericization of roots returned by Solve:

Compare with the numericization of roots returned by Reduce:

Compare with a single numerical root returned by FindRoot:

Compare with the numericization of a single root returned by FindInstance:

Possible Issues  (3)

NRoots returns unevaluated when called on a non-polynomial equation:

NRoots can return small imaginary parts for polynomials with real roots:

Use Chop to remove them:

Increasing MaxIterations does not necessarily give more accurate results:

In such cases, increasing the PrecisionGoal can sometimes give more precise results:

Interactive Examples  (1)

Interactively plot the real roots of a cubic polynomial:

Wolfram Research (1988), NRoots, Wolfram Language function, https://reference.wolfram.com/language/ref/NRoots.html (updated 2007).

Text

Wolfram Research (1988), NRoots, Wolfram Language function, https://reference.wolfram.com/language/ref/NRoots.html (updated 2007).

CMS

Wolfram Language. 1988. "NRoots." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2007. https://reference.wolfram.com/language/ref/NRoots.html.

APA

Wolfram Language. (1988). NRoots. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/NRoots.html

BibTeX

@misc{reference.wolfram_2024_nroots, author="Wolfram Research", title="{NRoots}", year="2007", howpublished="\url{https://reference.wolfram.com/language/ref/NRoots.html}", note=[Accessed: 22-November-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_nroots, organization={Wolfram Research}, title={NRoots}, year={2007}, url={https://reference.wolfram.com/language/ref/NRoots.html}, note=[Accessed: 22-November-2024 ]}