version 3.8
Dumux::NumericDifferentiation Class Reference

A class for numeric differentiation with respect to a scalar parameter.

#include <dumux/common/numericdifferentiation.hh>

Static Public Member Functions

template<class Scalar >
static Scalar epsilon (const Scalar value, const Scalar baseEps=1e-10)
 Computes the epsilon used for numeric differentiation. More...
 
template<class Function , class Scalar , class FunctionEvalType >
static void partialDerivative (const Function &function, Scalar x0, FunctionEvalType &derivative, const FunctionEvalType &fx0, const int numericDifferenceMethod=1)
 Computes the derivative of a function with respect to a function parameter. More...
 
template<class Function , class Scalar , class FunctionEvalType >
static void partialDerivative (const Function &function, Scalar x0, FunctionEvalType &derivative, const FunctionEvalType &fx0, const Scalar eps, const int numericDifferenceMethod=1)
 Computes the derivative of a function with respect to a function parameter. More...
 

Member Function Documentation

◆ epsilon()

template<class Scalar >
static Scalar Dumux::NumericDifferentiation::epsilon ( const Scalar  value,
const Scalar  baseEps = 1e-10 
)
inlinestatic
Parameters
valueThe value of the variable with respect to which we are differentiating
baseEpsThe step width which we are using for differentiation

◆ partialDerivative() [1/2]

template<class Function , class Scalar , class FunctionEvalType >
static void Dumux::NumericDifferentiation::partialDerivative ( const Function &  function,
Scalar  x0,
FunctionEvalType &  derivative,
const FunctionEvalType &  fx0,
const int  numericDifferenceMethod = 1 
)
inlinestatic
Note
Overload using default epsilon computation

◆ partialDerivative() [2/2]

template<class Function , class Scalar , class FunctionEvalType >
static void Dumux::NumericDifferentiation::partialDerivative ( const Function &  function,
Scalar  x0,
FunctionEvalType &  derivative,
const FunctionEvalType &  fx0,
const Scalar  eps,
const int  numericDifferenceMethod = 1 
)
inlinestatic
Parameters
functionThe function to derive
x0The parameter at which the derivative is ought to be evaluated
derivativeThe partial derivative (output)
fx0The result of the function evaluated at x0
epsThe numeric epsilon used in the differentiation
numericDifferenceMethodThe numeric difference method (1: forward differences (default), 0: central differences, -1: backward differences)

The documentation for this class was generated from the following file: