![]() |
Object-oriented Scientific Computing Library: Version 0.910
|
Derivatives for equally-spaced abscissas. More...
#include <eqi_deriv.h>
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 137 of file eqi_deriv.h.
Public Member Functions | |
int | set_npoints (int npoints) |
Set the number of points to use for first derivatives (default 5) | |
int | set_npoints2 (int npoints) |
Set the number of points to use for second derivatives (default 5) | |
virtual int | calc_err (double x, func_t &func, double &dfdx, double &err) |
Calculate the first derivative of func w.r.t. x. | |
virtual int | calc2_err (double x, func_t &func, double &dfdx, double &err) |
Calculate the second derivative of func w.r.t. x. | |
virtual int | calc3_err (double x, func_t &func, double &dfdx, double &err) |
Calculate the third derivative of func w.r.t. x. | |
double | calc_vector (double x, double x0, double dx, size_t nx, const vec_t &y) |
Calculate the derivative at x given an array. | |
double | calc2_vector (double x, double x0, double dx, size_t nx, const vec_t &y) |
Calculate the second derivative at x given an array. | |
double | calc3_vector (double x, double x0, double dx, size_t nx, const vec_t &y) |
Calculate the third derivative at x given an array. | |
int | deriv_vector (size_t nv, double dx, const vec_t &y, vec_t &dydx) |
Calculate the derivative of an entire array. | |
virtual const char * | type () |
Return string denoting type ("eqi_deriv") | |
Data Fields | |
double | h |
Stepsize (Default ![]() | |
double | xoff |
Offset (default 0.0) |
int eqi_deriv< func_t, vec_t >::set_npoints | ( | int | npoints | ) | [inline] |
Acceptable values are 2-5 (see above).
Definition at line 159 of file eqi_deriv.h.
int eqi_deriv< func_t, vec_t >::set_npoints2 | ( | int | npoints | ) | [inline] |
Acceptable values are 3-5 (see above).
Definition at line 185 of file eqi_deriv.h.
double eqi_deriv< func_t, vec_t >::calc_vector | ( | double | x, |
double | x0, | ||
double | dx, | ||
size_t | nx, | ||
const vec_t & | y | ||
) | [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 240 of file eqi_deriv.h.
double eqi_deriv< func_t, vec_t >::calc2_vector | ( | double | x, |
double | x0, | ||
double | dx, | ||
size_t | nx, | ||
const vec_t & | y | ||
) | [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 256 of file eqi_deriv.h.
double eqi_deriv< func_t, vec_t >::calc3_vector | ( | double | x, |
double | x0, | ||
double | dx, | ||
size_t | nx, | ||
const vec_t & | y | ||
) | [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 273 of file eqi_deriv.h.
int eqi_deriv< func_t, vec_t >::deriv_vector | ( | size_t | nv, |
double | dx, | ||
const vec_t & | y, | ||
vec_t & | dydx | ||
) | [inline] |
Right now this uses np=5.
Definition at line 286 of file eqi_deriv.h.
Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).