#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).
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 135 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 double | calc (double x, void *pa, func_t &func) |
Calculate the first derivative of func w.r.t. x. | |
virtual double | calc2 (double x, void *pa, func_t &func) |
Calculate the second derivative of func w.r.t. x. | |
virtual double | calc3 (double x, void *pa, func_t &func) |
Calculate the third derivative of func w.r.t. x. | |
double | calc_array (double x, double x0, double dx, size_t nx, const vec_t &y) |
Calculate the derivative at x given an array. | |
double | calc2_array (double x, double x0, double dx, size_t nx, const vec_t &y) |
Calculate the second derivative at x given an array. | |
double | calc3_array (double x, double x0, double dx, size_t nx, const vec_t &y) |
Calculate the third derivative at x given an array. | |
int | deriv_array (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 set_npoints | ( | int | npoints | ) | [inline] |
Set the number of points to use for first derivatives (default 5).
Acceptable values are 2-5 (see above).
Definition at line 157 of file eqi_deriv.h.
int set_npoints2 | ( | int | npoints | ) | [inline] |
Set the number of points to use for second derivatives (default 5).
Acceptable values are 3-5 (see above).
Definition at line 183 of file eqi_deriv.h.
double calc_array | ( | double | x, | |
double | x0, | |||
double | dx, | |||
size_t | nx, | |||
const vec_t & | y | |||
) | [inline] |
Calculate the derivative at x
given an array.
This calculates the derivative at x
given a func_tion 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 234 of file eqi_deriv.h.
double calc2_array | ( | double | x, | |
double | x0, | |||
double | dx, | |||
size_t | nx, | |||
const vec_t & | y | |||
) | [inline] |
Calculate the second derivative at x
given an array.
This calculates the second derivative at x
given a func_tion 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 251 of file eqi_deriv.h.
double calc3_array | ( | double | x, | |
double | x0, | |||
double | dx, | |||
size_t | nx, | |||
const vec_t & | y | |||
) | [inline] |
Calculate the third derivative at x
given an array.
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 269 of file eqi_deriv.h.
int deriv_array | ( | size_t | nv, | |
double | dx, | |||
const vec_t & | y, | |||
vec_t & | dydx | |||
) | [inline] |
Calculate the derivative of an entire array.
Right now this uses np=5.
Definition at line 283 of file eqi_deriv.h.
Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.
Project hosting provided by
,
O2scl Sourceforge Project Page