#include <gsl_deriv.h>
The derivative computation will never fail, but the results will be incorrect for sufficiently difficult functions or if the step size is not properly chosen.
Some successive derivative computations can be made more efficient by using the optimized stepsize in gsl_deriv::h_opt , which is set by the most recent last derivative computation.
examples/ex_deriv.cpp
and the Numerical differentiation example .
Definition at line 88 of file gsl_deriv.h.
Public Member Functions | |
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 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 232 of file gsl_deriv.h.
double h |
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 106 of file gsl_deriv.h.
double h_opt |
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 114 of file gsl_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