Class ScalarFirstOrderDifferentiator

  • All Implemented Interfaces:
    Differentiator<Double,​Double,​Double>

    public class ScalarFirstOrderDifferentiator
    extends Object
    implements Differentiator<Double,​Double,​Double>
    Differentiates a scalar function with respect to its argument using finite difference.

    For a function $y = f(x)$ where $x$ and $y$ are scalars, this class produces a gradient function $g(x)$, i.e. a function that returns the gradient for each point $x$, where $g$ is the scalar $\frac{dy}{dx}$.

    • Constructor Detail

      • ScalarFirstOrderDifferentiator

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

        public ScalarFirstOrderDifferentiator​(FiniteDifferenceType differenceType)
        Creates an instance using the default value of eps (10-5).
        Parameters:
        differenceType - the differencing type to be used in calculating the gradient function
      • ScalarFirstOrderDifferentiator

        public ScalarFirstOrderDifferentiator​(FiniteDifferenceType differenceType,
                                              double eps)
        Creates an instance.

        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.

        Parameters:
        differenceType - the differencing type to be used in calculating the gradient function
        eps - the step size used to approximate the derivative