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 104 virtual fp_t
deriv(fp_t x, func_t &func) {
116 virtual fp_t
deriv2(fp_t x, func_t &func) {
121 this,std::placeholders::_1,&func);
131 virtual fp_t
deriv3(fp_t x, func_t &func) {
136 this,std::placeholders::_1,&func);
157 virtual int deriv_err(fp_t x, func_t &func, fp_t &dfdx,
164 fp_t &d2fdx2, fp_t &err) {
167 this,std::placeholders::_1,&func);
179 fp_t &d3fdx3, fp_t &err) {
182 this,std::placeholders::_1,&func);
190 #ifdef O2SCL_NEVER_DEFINED 195 virtual const char *
type() {
return "deriv"; }
199 #ifndef DOXYGEN_INTERNAL 221 fp_t &dfdx, fp_t &err)=0;
235 this,std::placeholders::_1,fp);
244 #ifndef DOXYGEN_NO_O2NS virtual fp_t deriv_int(fp_t x, funct &func)
Calculate the first derivative of func w.r.t. x.
The main O<span style='position: relative; top: 0.3em; font-size: 0.8em'>2</span>scl O$_2$scl names...
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.
fp_t derivfun2(fp_t x, func_t *fp)
The function for the third derivative.
virtual fp_t get_err()
Get uncertainty of last calculation.
bool err_nonconv
If true, call the error handler if the routine does not "converge".
fp_t derivfun(fp_t x, func_t *fp)
The function for the second derivative.
Numerical differentiation base [abstract base].
virtual const char * type()
Return string denoting type ("deriv")
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.
int verbose
Output control.
virtual fp_t deriv3(fp_t x, func_t &func)
Calculate the third derivative of func w.r.t. x.
bool from_deriv
Avoids infinite loops in case the user calls the base class version.
virtual int deriv_err_int(fp_t x, funct &func, fp_t &dfdx, fp_t &err)=0
Calculate the first derivative of func w.r.t. x and the uncertainty.
std::function< double(double)> funct
One-dimensional function typedef.
A structure for passing the function to second and third derivatives [protected]. ...
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.
virtual fp_t deriv2(fp_t x, func_t &func)
Calculate the second derivative of func w.r.t. x.
fp_t derr
The uncertainity in the most recent derivative computation.
virtual fp_t deriv(fp_t x, func_t &func)
Calculate the first derivative of func w.r.t. x.
func_t * func
The pointer to the function.