Derivatives for equally-spaced abscissas. More...
#include <deriv_eqi.h>
Public Member Functions | |
int | set_npoints (int npoints) |
Set the number of points to use for first derivatives (default 5) More... | |
int | set_npoints2 (int npoints) |
Set the number of points to use for second derivatives (default 5) More... | |
virtual int | deriv_err (double x, func_t &func, double &dfdx, double &err) |
Calculate the first derivative of func w.r.t. x. | |
virtual int | deriv2_err (double x, func_t &func, double &dfdx, double &err) |
Calculate the second derivative of func w.r.t. x. | |
virtual int | deriv3_err (double x, func_t &func, double &dfdx, double &err) |
Calculate the third derivative of func w.r.t. x. | |
double | deriv_vector (double x, double x0, double dx, size_t nx, const vec_t &y) |
Calculate the derivative at x given an array. More... | |
double | deriv2_vector (double x, double x0, double dx, size_t nx, const vec_t &y) |
Calculate the second derivative at x given an array. More... | |
double | deriv3_vector (double x, double x0, double dx, size_t nx, const vec_t &y) |
Calculate the third derivative at x given an array. More... | |
int | deriv_vector (size_t nv, double dx, const vec_t &y, vec_t &dydx) |
Calculate the derivative of an entire array. More... | |
virtual const char * | type () |
Return string denoting type ("deriv_eqi") | |
![]() | |
virtual double | deriv (double x, func_t &func) |
Calculate the first derivative of func w.r.t. x. More... | |
virtual double | deriv2 (double x, func_t &func) |
Calculate the second derivative of func w.r.t. x. | |
virtual double | deriv3 (double x, func_t &func) |
Calculate the third derivative of func w.r.t. x. | |
virtual double | get_err () |
Get uncertainty of last calculation. | |
Public Attributes | |
double | h |
Stepsize (Default ![]() | |
double | xoff |
Offset (default 0.0) | |
![]() | |
bool | err_nonconv |
If true, call the error handler if the routine does not "converge". | |
int | verbose |
Output control. | |
Protected Member Functions | |
virtual int | deriv_err_int (double x, funct11 &func, double &dfdx, double &err) |
Calculate the first derivative of func w.r.t. x and the uncertainty. More... | |
double | derivp2 (double x, double p, func_t &func) |
Two-point first derivative. | |
double | derivp3 (double x, double p, func_t &func) |
Three-point first derivative. | |
double | derivp4 (double x, double p, func_t &func) |
Four-point first derivative. | |
double | derivp5 (double x, double p, func_t &func) |
Five-point first derivative. | |
double | deriv_vector3 (double x, double x0, double dx, size_t nx, const vec_t &y, size_t ix) |
Three-point first derivative for arrays. | |
double | deriv_vector4 (double x, double x0, double dx, size_t nx, const vec_t &y, size_t ix) |
Four-point first derivative for arrays. | |
double | deriv_vector5 (double x, double x0, double dx, size_t nx, const vec_t &y, size_t ix) |
Five-point first derivative for arrays. | |
double | deriv2p3 (double x, double p, func_t &func) |
Three-point second derivative. | |
double | deriv2p4 (double x, double p, func_t &func) |
Four-point second derivative. | |
double | deriv2p5 (double x, double p, func_t &func) |
Five-point second derivative. | |
![]() | |
virtual double | deriv_int (double x, funct11 &func) |
Calculate the first derivative of func w.r.t. x. More... | |
double | derivfun (double x, func_t *fp) |
The function for the second derivative. | |
double | derivfun2 (double x, func_t *fp) |
The function for the third derivative. | |
Protected Attributes | |
double(deriv_eqi::* | cp )(double x, double p, func_t &func) |
Pointer to the first derivative function. | |
double(deriv_eqi::* | cap )(double x, double x0, double dx, size_t nx, const vec_t &y, size_t ix) |
Pointer to the first derivative for arrays function. | |
double(deriv_eqi::* | c2p )(double x, double p, func_t &func) |
Pointer to the second derivative function. | |
double(deriv_eqi::* | c2ap )(double x, double x0, double dx, size_t nx, const vec_t &y, size_t ix) |
Pointer to the second derivative for arrays function. | |
double(deriv_eqi::* | c3p )(double x, double h, double p, func_t &func) |
Pointer to the third derivative function. | |
double(deriv_eqi::* | c3ap )(double x, double x0, double dx, size_t nx, const vec_t &y, size_t ix) |
Pointer to the third derivative for arrays function. | |
![]() | |
bool | from_deriv |
Avoids infinite loops in case the user calls the base class version. | |
double | derr |
The uncertainity in the most recent derivative computation. | |
This is an implementation of the formulas for equally-spaced abscissas as indicated below. The level of approximation is specified in set_npoints(). The value of can be specified in
xoff
(default is zero).
Two-point formula (note that this is independent of p).
Three-point formula from Abramowitz and Stegun
Four-point formula from Abramowitz and Stegun
Five-point formula from Abramowitz and Stegun
The relations above can be confined to give formulas for second derivative formulas: Three-point formula
Four-point formula:
Five-point formula:
Six-point formula:
Seven-point formula:
Definition at line 144 of file deriv_eqi.h.
|
inline |
This calculates the second derivative at x
given a function specified in an array y
of size nx
with equally spaced abscissas. The first abscissa should be given as x0
and the distance between adjacent abscissas should be given as dx
. The value x
need not be one of the abscissas (i.e. it can lie in between an interval). The appropriate offset is calculated automatically.
Definition at line 263 of file deriv_eqi.h.
|
inline |
This calculates the third derivative at x
given a function specified in an array y
of size nx
with equally spaced abscissas. The first abscissa should be given as x0
and the distance between adjacent abscissas should be given as dx
. The value x
need not be one of the abscissas (i.e. it can lie in between an interval). The appropriate offset is calculated automatically.
Definition at line 280 of file deriv_eqi.h.
|
inlineprotectedvirtual |
This function doesn't do anything, and isn't required for this class since it computes higher-order derivatives directly.
Implements o2scl::deriv_base< func_t >.
Definition at line 323 of file deriv_eqi.h.
|
inline |
This calculates the derivative at x
given a function specified in an array y
of size nx
with equally spaced abscissas. The first abscissa should be given as x0
and the distance between adjacent abscissas should be given as dx
. The value x
need not be one of the abscissas (i.e. it can lie in between an interval). The appropriate offset is calculated automatically.
Definition at line 247 of file deriv_eqi.h.
|
inline |
Right now this uses np=5.
Definition at line 293 of file deriv_eqi.h.
|
inline |
Acceptable values are 2-5 (see above).
Definition at line 166 of file deriv_eqi.h.
|
inline |
Acceptable values are 3-5 (see above).
Definition at line 192 of file deriv_eqi.h.
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).