Class NumericalDerivativesEx1

java.lang.Object
com.imsl.test.example.math.NumericalDerivativesEx1

public class NumericalDerivativesEx1 extends Object

NumericalDerivatives Example 1: Approximates the gradient of a function of two variables using numerical differentiation.

A simple use of NumericalDerivatives is shown. The gradient of the function $$f(y_1 ,y_2 ) = a\exp (by_1 ) + cy_1 y_2^2$$ is required for values \(a = 2.5e6\), \(b = 3.4\), \(c = 4.5\), \(y_1 = 2.1\), \(y_2 = 3.2\).

The numerical gradient is compared to the analytic gradient, cast as a 1 by 2 Jacobian: $$ grad(f) = \left[ {\begin{array}{*{20}c} {ab\exp (by_1 ) + cy_2^2 ,} & {2cy_1 y_2 } \\ \end{array} } \right] $$ This analytic gradient is expected to approximately agree with the numerical differentiation gradient. Relative agreement should be approximately the square root of machine precision. That is achieved here. Generally this is the most accuracy one can expect using one sided divided differences.

See Also:
  • Constructor Details

    • NumericalDerivativesEx1

      public NumericalDerivativesEx1()
  • Method Details

    • main

      public static void main(String[] args)