Go to the documentation of this file.
32 #include <o2scl/funct.h>
34 #ifndef DOXYGEN_NO_O2NS
63 template<
class func_t=funct,
class fp_t=
double>
class deriv_base {
65 #ifndef DOXYGEN_INTERNAL
84 typedef std::function<fp_t(fp_t)> internal_func_t;
106 virtual fp_t
deriv(fp_t x, func_t &func) {
118 virtual fp_t
deriv2(fp_t x, func_t &func) {
123 this,std::placeholders::_1,&func);
133 virtual fp_t
deriv3(fp_t x, func_t &func) {
138 this,std::placeholders::_1,&func);
159 virtual int deriv_err(fp_t x, func_t &func, fp_t &dfdx,
166 fp_t &d2fdx2, fp_t &err) {
169 this,std::placeholders::_1,&func);
181 fp_t &d3fdx3, fp_t &err) {
184 this,std::placeholders::_1,&func);
192 #ifdef O2SCL_NEVER_DEFINED
197 virtual const char *
type() {
return "deriv"; }
201 #ifndef DOXYGEN_INTERNAL
211 deriv_err_int(x,func,dx,derr);
222 virtual int deriv_err_int(fp_t x, internal_func_t &func,
223 fp_t &dfdx, fp_t &err)=0;
237 this,std::placeholders::_1,fp);
238 fp_t val=deriv_int(x,mf);
246 #ifndef DOXYGEN_NO_O2NS
A structure for passing the function to second and third derivatives [protected].
fp_t derivfun(fp_t x, func_t *fp)
The function for the second derivative.
int verbose
Output control.
virtual int deriv2_err(fp_t x, func_t &func, fp_t &d2fdx2, fp_t &err)
Calculate the second derivative of func w.r.t. x and the uncertainty.
virtual fp_t get_err()
Get uncertainty of last calculation.
The main O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$scl names...
Numerical differentiation base [abstract base].
func_t * func
The pointer to the function.
virtual int deriv_err(fp_t x, func_t &func, fp_t &dfdx, fp_t &err)=0
Calculate the first derivative of func w.r.t. x and the uncertainty.
bool err_nonconv
If true, call the error handler if the routine does not "converge".
fp_t derr
The uncertainity in the most recent derivative computation.
fp_t derivfun2(fp_t x, func_t *fp)
The function for the third derivative.
virtual fp_t deriv3(fp_t x, func_t &func)
Calculate the third derivative of func w.r.t. x.
virtual fp_t deriv_int(fp_t x, internal_func_t &func)
Calculate the first derivative of func w.r.t. x.
virtual int deriv3_err(fp_t x, func_t &func, fp_t &d3fdx3, fp_t &err)
Calculate the third derivative of func w.r.t. x and the uncertainty.
bool from_deriv
Avoids infinite loops in case the user calls the base class version.
virtual const char * type()
Return string denoting type ("deriv")
virtual int deriv_err_int(fp_t x, internal_func_t &func, fp_t &dfdx, fp_t &err)=0
Calculate the first derivative of func w.r.t. x and the uncertainty.
virtual fp_t deriv(fp_t x, func_t &func)
Calculate the first derivative of func w.r.t. x.
virtual fp_t deriv2(fp_t x, func_t &func)
Calculate the second derivative of func w.r.t. x.
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).