23 fFunctionCopied(false),
31 fFunctionCopied(copyFunc),
62 if (&rhs ==
this)
return *
this;
97 double deriv = h2*(8*d2 - d0)/3.;
103 double e0 = (std::abs(
f1) + std::abs(f2)) * keps;
104 double e2 = 2* (std::abs( g1) + std::abs(g2)) * keps + e0;
105 double delta = std::max( std::abs( h2*d0), std::abs( deriv) ) * std::abs(
x)/
h * keps;
108 double err_trunc = std::abs( deriv - h2*d0 );
110 double err_round = std::abs( e2/
h) + delta;
125 xx =
x+(3.0/4.0)*
h;
double f3 = (
function)(xx);
130 double r2 = 2.0*(f4 - f2);
131 double r4 = (22.0 / 3.0) * (f4 - f3) - (62.0 / 3.0) * (f3 - f2) +
132 (52.0 / 3.0) * (f2 -
f1);
147 double result = r4 /
h;
148 double abserr_trunc =
fabs ((r4 - r2) /
h);
149 double abserr_round =
fabs (e4 /
h) + dy;
171 double d0 = f3 - 2*f2 +
f1;
172 double d2 = 4*g3 - 8*f2 +4*g1;
174 double deriv = hh*(4*d2 - d0)/3.;
192 double hhh = 1/(
h*
h*
h);
193 double d0 = 0.5*
f1 - f2 +f3 - 0.5*f4;
194 double d2 = 4*f2 - 8*g2 +8*g3 - 4*f3;
196 double deriv = hhh*(4*d2 - d0)/3.;
Interface (abstract class) for generic functions objects of one-dimension Provides a method to evalua...
User class for calculating the derivatives of a function.
double Derivative2(double x)
Returns the second derivative of the function at point x, computed by Richardson's extrapolation meth...
~RichardsonDerivator()
Destructor: Removes function if needed.
RichardsonDerivator(double h=0.001)
Default Constructor.
double DerivativeForward(double x)
Computation of the first derivative using a forward formula.
RichardsonDerivator & operator=(const RichardsonDerivator &rhs)
Assignment operator.
double Derivative3(double x)
Returns the third derivative of the function at point x, computed by Richardson's extrapolation metho...
double Derivative1(double x)
Returns the first derivative of the function at point x, computed by Richardson's extrapolation metho...
void SetFunction(const IGenFunction &f)
Set function for derivative calculation (copy the function if option has been enabled in the construc...
const IGenFunction * fFunction
Namespace for new Math classes and functions.
VecExpr< UnaryOp< Fabs< T >, VecExpr< A, T, D >, T >, T, D > fabs(const VecExpr< A, T, D > &rhs)
void function(const Char_t *name_, T fun, const Char_t *docstring=0)