3.5-git
DUNE for Multi-{Phase, Component, Scale, Physics, ...} flow and transport in porous media
Static Public Member Functions | List of all members
Dumux::NumericDifferentiation Class Reference

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

#include <dumux/common/numericdifferentiation.hh>

Description

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

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 repect 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 repect 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

Computes the epsilon used for numeric differentiation.

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

Computes the derivative of a function with repect to a function parameter.

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

Computes the derivative of a function with repect to a function parameter.

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: foward differences (default), 0: central differences, -1: backward differences)

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