Numerical differentiation base [abstract base].
More...
#include <deriv.h>
|
struct | dpars |
| A structure for passing the function to second and third derivatives [protected]. More...
|
|
|
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.
|
|
virtual int | deriv_err (double x, func_t &func, double &dfdx, double &err)=0 |
| Calculate the first derivative of func w.r.t. x and the uncertainty.
|
|
virtual int | deriv2_err (double x, func_t &func, double &d2fdx2, double &err) |
| Calculate the second derivative of func w.r.t. x and the uncertainty.
|
|
virtual int | deriv3_err (double x, func_t &func, double &d3fdx3, double &err) |
| Calculate the third derivative of func w.r.t. x and the uncertainty.
|
|
virtual const char * | type () |
| Return string denoting type ("deriv")
|
|
|
bool | err_nonconv |
| If true, call the error handler if the routine does not "converge".
|
|
int | verbose |
| Output control.
|
|
|
virtual double | deriv_int (double x, funct11 &func) |
| Calculate the first derivative of func w.r.t. x. More...
|
|
virtual int | deriv_err_int (double x, funct11 &func, double &dfdx, double &err)=0 |
| Calculate the first derivative of func w.r.t. x and the uncertainty. 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.
|
|
|
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.
|
|
template<class func_t = funct11>
class o2scl::deriv_base< func_t >
This base class does not perform any actual differentiation. Use one of the children o2scl::deriv_cern, o2scl::deriv_gsl, or o2scl::deriv_eqi instead.
This base class contains some code to automatically apply the first derivative routines to compute second or third derivatives. The error estimates for these will likely be underestimated.
- Note
- Because this class template aims to automatically provide second and third derivatives, one must overload either both deriv() and deriv_int() or both deriv_err() and deriv_err_int().
-
If err_nonconv is set to false, and the derivative computation fails, then the functions deriv(), deriv2() and deriv3() may return the wrong result without warning. Similarly, if err_nonconv is set to false, it is the user's responsibility to check the return value from deriv_err(), deriv2_err(), and deriv3_err() to see if an error occurred.
- Idea for Future:
- Improve the methods for second and third derivatives
Definition at line 63 of file deriv.h.
◆ deriv()
template<class func_t = funct11>
◆ deriv_err_int()
template<class func_t = funct11>
◆ deriv_int()
template<class func_t = funct11>
This is an internal version of deriv() which is used in computing second and third derivatives
Definition at line 206 of file deriv.h.
The documentation for this class was generated from the following file:
- /home/awsteiner/wcs/o2scl/src/deriv/deriv.h