#include <gsl_deriv.h>
This class computes the numerical derivative of a function. The stepsize h should be specified before use. If similar functions are being differentiated in succession, the user may be able to increase the speed of later derivatives by setting the new stepsize equal to the optimized stepsize from the previous differentiation, by setting h to h_opt.
Definition at line 53 of file gsl_deriv.h.
Public Member Functions | |
gsl_deriv () | |
virtual | ~gsl_deriv () |
virtual int | calc_err (double x, param_t &pa, func_t &func, double &dfdx, double &err) |
Calculate the first derivative of func w.r.t. x and uncertainty. | |
virtual const char * | type () |
Return string denoting type ("gsl_deriv"). | |
Data Fields | |
double | h |
Initial stepsize. | |
double | h_opt |
The last value of the optimized stepsize. | |
Protected Member Functions | |
virtual int | calc_err_int (double x, typename deriv< param_t, func_t >::dpars &pa, funct< typename deriv< param_t, func_t >::dpars > &func, double &dfdx, double &err) |
Internal version of calc_err() for second and third derivatives. | |
template<class func2_t, class param2_t> | |
int | central_deriv (double x, double hh, double &result, double &abserr_round, double &abserr_trunc, func2_t &func, param2_t &pa) |
Compute derivative using 5-point rule. |
int central_deriv | ( | double | x, | |
double | hh, | |||
double & | result, | |||
double & | abserr_round, | |||
double & | abserr_trunc, | |||
func2_t & | func, | |||
param2_t & | pa | |||
) | [inline, protected] |
Compute derivative using 5-point rule.
Compute the derivative using the 5-point rule (x-h, x-h/2, x, x+h/2, x+h) and the error using the difference between the 5-point and the 3-point rule (x-h,x,x+h). Note that the central point is not used for either.
This must be a class template because it is used by both calc_err() and calc_err_int().
Definition at line 199 of file gsl_deriv.h.
double h |
Initial stepsize.
This should be specified before a call to calc() or calc_err(). If it is zero, then will used, or if
x
is zero, then will be used.
Definition at line 70 of file gsl_deriv.h.
double h_opt |
The last value of the optimized stepsize.
This is initialized to zero in the constructor and set by calc_err() to the most recent value of the optimized stepsize.
Definition at line 79 of file gsl_deriv.h.