Class for finding the root of a one dimensional function using the Brent algorithm.
It will use the Brent Method for finding function roots in a given interval. First, a grid search is used to bracket the root value with the a step size = (xmax-xmin)/npx. The step size can be controlled via the SetNpx() function. A default value of npx = 100 is used. The default value con be changed using the static method SetDefaultNpx. If the function is unimodal or if its extrema are far apart, setting the fNpx to a small value speeds the algorithm up many times. Then, Brent's method is applied on the bracketed interval. It will use the Brent Method for finding function roots in a given interval. If the Brent method fails to converge the bracketing is repeted on the latest best estimate of the interval. The procedure is repeted with a maximum value (default =10) which can be set for all BrentRootFinder classes with the method SetDefaultNSearch
This class is implemented from TF1::GetX() method.
Definition at line 62 of file BrentRootFinder.h.
bool ROOT::Math::BrentRootFinder::Solve |
( |
int |
maxIter = 100 , |
|
|
double |
absTol = 1E-8 , |
|
|
double |
relTol = 1E-10 |
|
) |
| |
|
virtual |
Returns the X value corresponding to the function value fy for (xmin<x<xmax).
Method: First, the grid search is used to bracket the maximum with the step size = (xmax-xmin)/fNpx. This way, the step size can be controlled via the SetNpx() function. If the function is unimodal or if its extrema are far apart, setting the fNpx to a small value speeds the algorithm up many times. Then, Brent's method is applied on the bracketed interval.
@param maxIter maximum number of iterations. @param absTol desired absolute error in the minimum position. @param absTol desired relative error in the minimum position.
Implements ROOT::Math::IRootFinderMethod.
Definition at line 63 of file BrentRootFinder.cxx.