public class ScalarFieldFirstOrderDifferentiator extends Object implements Differentiator<DoubleArray,Double,DoubleArray>
For a function $y = f(\mathbf{x})$ where $\mathbf{x}$ is a n-dimensional vector and $y$ is a scalar, this class produces a gradient function $\mathbf{g}(\mathbf{x})$, i.e. a function that returns the gradient for each point $\mathbf{x}$, where $\mathbf{g}$ is the n-dimensional vector $\frac{dy}{dx_i}$.
| Constructor and Description |
|---|
ScalarFieldFirstOrderDifferentiator()
Creates an instance using the default values of differencing type (central) and eps (10-5).
|
ScalarFieldFirstOrderDifferentiator(FiniteDifferenceType differenceType,
double eps)
Creates an instance that approximates the derivative of a scalar function by finite difference.
|
| Modifier and Type | Method and Description |
|---|---|
Function<DoubleArray,DoubleArray> |
differentiate(Function<DoubleArray,Double> function)
Provides a function that performs the differentiation.
|
Function<DoubleArray,DoubleArray> |
differentiate(Function<DoubleArray,Double> function,
Function<DoubleArray,Boolean> domain)
Provides a function that performs the differentiation.
|
public ScalarFieldFirstOrderDifferentiator()
public ScalarFieldFirstOrderDifferentiator(FiniteDifferenceType differenceType, double eps)
If the size of the domain is very small or very large, consider re-scaling first. If this value is too small, the result will most likely be dominated by noise. Use around 10-5 times the domain size.
differenceType - the type, forward, backward or central. In most situations, central is besteps - the step size used to approximate the derivativepublic Function<DoubleArray,DoubleArray> differentiate(Function<DoubleArray,Double> function)
Differentiatordifferentiate in interface Differentiator<DoubleArray,Double,DoubleArray>function - a function for which to get the differential functionpublic Function<DoubleArray,DoubleArray> differentiate(Function<DoubleArray,Double> function, Function<DoubleArray,Boolean> domain)
Differentiatordifferentiate in interface Differentiator<DoubleArray,Double,DoubleArray>function - a function for which to get the differential functiondomain - a function that returns false if the requested value is not in the domain, true otherwiseCopyright 2009-Present by OpenGamma Inc. and individual contributors
Apache v2 licensed
Additional documentation can be found at strata.opengamma.io.