USGS

Isis 3.0 Developer's Reference (API)

Home

Isis::FunctionTools Class Reference

A collection of tools for mathmatical function root finding, maximization, etc (eventually) This class contains only static methods, and cannot be instantiated. More...

#include <FunctionTools.h>

List of all members.

Static Public Member Functions

static QList< double > realLinearRoots (double coeffLinearTerm, double coeffConstTerm)
 Find the real roots (0 or 1) of a linear equation Form: coeffLinearTerm*X + coeffConstTerm = 0.0 NOTE: in the case of infinite roots an empty set is returned.
static QList< double > realQuadraticRoots (double coeffQuadTerm, double coeffLinearTerm, double coeffConstTerm)
 The correct way to find the real roots of a quadratic (0, 1, or 2) (according to numerical recipies 3rd edtion page 227).
static QList< double > realCubicRoots (double coeffCubicTerm, double coeffQuadTerm, double coeffLinearTerm, double coeffConstTerm)
 Find the real roots of a cubic (1, 2, or 3) (see numerical recipies 3rd edtion page 227) Form: coeffCubicTerm*X^3 + coeffQuadTerm*X^2 + coeffLinearTerm*X + coeffConstTerm = 0.0.
template<typename Functor >
static bool brentsRootFinder (Functor &func, const QList< double > pt1, const QList< double > pt2, double tol, int maxIter, double &root)
 Van Wijngaarden-Dekker-Brent Method for root finding on a discreetly defined function meaning that we can evaluate the function for discreet points, but we lack a global function and derivative definitions.

Detailed Description

A collection of tools for mathmatical function root finding, maximization, etc (eventually) This class contains only static methods, and cannot be instantiated.

Author:
2012-05-07 Orrin Thomas

Member Function Documentation

template<typename Functor >
static bool Isis::FunctionTools::brentsRootFinder ( Functor &  func,
const QList< double >  pt1,
const QList< double >  pt2,
double  tol,
int  maxIter,
double &  root 
) [inline, static]

Van Wijngaarden-Dekker-Brent Method for root finding on a discreetly defined function meaning that we can evaluate the function for discreet points, but we lack a global function and derivative definitions.

See Numerical Recipes 3rd eddition pages 454-456.

This method requires that the root be bounded on the interval [pt1,pt2], and is gaurenteed to convege a root (by Brent) in the interval as long the function is continous and can evaluated on that interval.

Note that if there are multiple roots on the interval the function will find one of them and there is no particular gaurentee which one. Note, also that I have changed the convergance criteria to enforce the nearness of the function to zero rather than the precision of the root.

Parameters:
functemplate parameter that must have a double operator()(double) defined
pt1one of the already defined points (x, y) that bracket the root
pt2one of the already defined points (x, y) that bracket the root
tolhow close to zero the function must come before iterations stop
maxiterthe maximum number of iterations before stoping the root search
rootthe returned root (if any)
Returns:
bool true if the solution converged, false otherwise

References _FILEINFO_, a, c, d, offset, Isis::IException::Programmer, and Isis::toString().

static QList<double> Isis::FunctionTools::realCubicRoots ( double  coeffCubicTerm,
double  coeffQuadTerm,
double  coeffLinearTerm,
double  coeffConstTerm 
) [inline, static]

Find the real roots of a cubic (1, 2, or 3) (see numerical recipies 3rd edtion page 227) Form: coeffCubicTerm*X^3 + coeffQuadTerm*X^2 + coeffLinearTerm*X + coeffConstTerm = 0.0.

Parameters:
coeffCubicTermcoefficient of the cubic term
coeffQuadTermcoefficient of the quadratic term
coefflinearTermcoefficient of the linear term
coeffConstTermcoefficient of the constant term

References a, c, Q, realQuadraticRoots(), and Isis::TWOPI().

static QList<double> Isis::FunctionTools::realLinearRoots ( double  coeffLinearTerm,
double  coeffConstTerm 
) [inline, static]

Find the real roots (0 or 1) of a linear equation Form: coeffLinearTerm*X + coeffConstTerm = 0.0 NOTE: in the case of infinite roots an empty set is returned.

Parameters:
coefflinearTermcoefficient of the linear term
coeffConstTermcoefficient of the constant term

Referenced by realQuadraticRoots().

static QList<double> Isis::FunctionTools::realQuadraticRoots ( double  coeffQuadTerm,
double  coeffLinearTerm,
double  coeffConstTerm 
) [inline, static]

The correct way to find the real roots of a quadratic (0, 1, or 2) (according to numerical recipies 3rd edtion page 227).

Form: coeffQuadTerm*X^2 + coeffLinearTerm*X + coeffConstTerm = 0.0

Parameters:
coeffQuadTermcoefficient of the quadratic term
coefflinearTermcoefficient of the linear term
coeffConstTermcoefficient of the constant term

References realLinearRoots().

Referenced by realCubicRoots().


The documentation for this class was generated from the following file: