ROOT logo
ROOT » MATH » MATHCORE » ROOT::Math::RootFinder

class ROOT::Math::RootFinder


         User Class to find the Root of one dimensional functions.
         The GSL Methods are implemented in MathMore and they are loaded automatically
         via the plug-in manager

         The possible types of Root-finding algorithms are:
         <ul>
         <li>Root Bracketing Algorithms which do not require function derivatives
         <ol>
         <li>RootFinder::kBRENT  (default method implemented in MathCore)
         <li>RootFinder::kGSL_BISECTION
         <li>RootFinder::kGSL_FALSE_POS
         <li>RootFinder::kGSL_BRENT
         </ol>
         <li>Root Finding Algorithms using Derivatives
         <ol>
         <li>RootFinder::kGSL_NEWTON
         <li>RootFinder::kGSL_SECANT
         <li>RootFinder::kGSL_STEFFENSON
         </ol>
         </ul>

         This class does not cupport copying

         @ingroup RootFinders


Function Members (Methods)

public:
virtual~RootFinder()
intIterate()
intIterations() const
const char*Name() const
doubleRoot() const
ROOT::Math::RootFinderRootFinder(ROOT::Math::RootFinder::EType type = RootFinder::kBRENT)
boolSetFunction(const ROOT::Math::IGradFunction& f, double xstart)
boolSetFunction(const ROOT::Math::IGenFunction& f, double xlow, double xup)
boolSetMethod(ROOT::Math::RootFinder::EType type = RootFinder::kBRENT)
boolSolve(int maxIter = 100, double absTol = 1E-8, double relTol = 1E-10)
intStatus() const

Data Members

public:
enum EType { kBRENT
kGSL_BISECTION
kGSL_FALSE_POS
kGSL_BRENT
kGSL_NEWTON
kGSL_SECANT
kGSL_STEFFENSON
};
private:
ROOT::Math::IRootFinderMethod*fSolvertype of algorithm to be used

Class Charts

Inheritance Inherited Members Includes Libraries
Class Charts

Function documentation

bool Solve(Function &f, Derivative &d, double start, int maxIter, double absTol, double relTol)
RootFinder(RootFinder::EType type = RootFinder::kBRENT)
            Construct a Root-Finder algorithm

virtual ~RootFinder()
RootFinder(const RootFinder & )
 usually copying is non trivial, so we make this unaccessible
{}
bool SetMethod(ROOT::Math::RootFinder::EType type = RootFinder::kBRENT)
bool SetFunction(const ROOT::Math::IGenFunction& f, double xlow, double xup)
            Provide to the solver the function and the initial search interval [xlow, xup]
            for algorithms not using derivatives (bracketing algorithms)
            The templated function f must be of a type implementing the \a operator() method,
            <em>  double  operator() (  double  x ) </em>
            Returns non zero if interval is not valid (i.e. does not contains a root)

return fSolver-> SetFunction(const ROOT::Math::IGenFunction& f, double xlow, double xup)
int Iterations() const
             Return the number of iteration performed to find the Root.

int Iterate()
            Perform a single iteration and return the Status

double Root() const
            Return the current and latest estimate of the Root

int Status() const
            Return the status of the last estimate of the Root
            = 0 OK, not zero failure

const char * Name() const
            Return the current and latest estimate of the lower value of the Root-finding interval (for bracketing algorithms)

double XLower() const {
return fSolver->XLower();
}

            Return the current and latest estimate of the upper value of the Root-finding interval (for bracketing algorithms)

double XUpper() const {
return  fSolver->XUpper();
}

            Get Name of the Root-finding solver algorithm