Package smile.math
Class Root
java.lang.Object
smile.math.Root
Root finding algorithms.

Method Summary
Modifier and TypeMethodDescriptionstatic double
find
(DifferentiableFunction func, double x1, double x2, double tol, int maxIter) Newton's method (also known as the Newton–Raphson method).static double
Brent's method for rootfinding.

Method Details

find
Brent's method for rootfinding. It combines the bisection method, the secant method and inverse quadratic interpolation. It has the reliability of bisection, but it can be as quick as some of the lessreliable methods. The algorithm tries to use the potentially fastconverging secant method or inverse quadratic interpolation if possible, but it falls back to the more robust bisection method if necessary.The method is guaranteed to converge as long as the function can be evaluated within the initial interval known to contain a root.
 Parameters:
func
 the function to be evaluated.x1
 the left end of search interval.x2
 the right end of search interval.tol
 the desired accuracy (convergence tolerance).maxIter
 the maximum number of iterations. Returns:
 the root.

find
public static double find(DifferentiableFunction func, double x1, double x2, double tol, int maxIter) Newton's method (also known as the Newton–Raphson method). This method finds successively better approximations to the roots of a realvalued function. Newton's method assumes the function to have a continuous derivative. Newton's method may not converge if started too far away from a root. However, when it does converge, it is faster than the bisection method, and is usually quadratic. Newton's method is also important because it readily generalizes to higherdimensional problems. Newtonlike methods with higher orders of convergence are the Householder's methods. Parameters:
func
 the function to be evaluated.x1
 the left end of search interval.x2
 the right end of search interval.tol
 the desired accuracy (convergence tolerance).maxIter
 the maximum number of iterations. Returns:
 the root.
