Class ScalarFieldFirstOrderDifferentiator

  • All Implemented Interfaces:

    public class ScalarFieldFirstOrderDifferentiator
    extends Object
    implements Differentiator<DoubleArray,​Double,​DoubleArray>
    Differentiates a scalar field (i.e. there is a scalar value for every point in some vector space) with respect to the vector space using finite difference.

    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 Detail

      • ScalarFieldFirstOrderDifferentiator

        public ScalarFieldFirstOrderDifferentiator()
        Creates an instance using the default values of differencing type (central) and eps (10-5).
      • ScalarFieldFirstOrderDifferentiator

        public ScalarFieldFirstOrderDifferentiator​(FiniteDifferenceType differenceType,
                                                   double eps)
        Creates an instance that approximates the derivative of a scalar function by finite difference.

        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 best
        eps - the step size used to approximate the derivative