Package com.opengamma.analytics.math.differentiation

Examples of com.opengamma.analytics.math.differentiation.ScalarFirstOrderDifferentiator


    assertEquals(-Math.sin(1.0), VECTOR_PARAMS.evaluate(2.0, parms), 0.0);

    final Function1D<Double, Double> func = VECTOR_PARAMS.asFunctionOfArguments(parms);
    assertEquals(1.0, func.evaluate(-Math.PI), 0.0);

    final ScalarFirstOrderDifferentiator diff = new ScalarFirstOrderDifferentiator();
    final Function1D<Double, Double> grad = diff.differentiate(func);
    assertEquals(-0.5, grad.evaluate(0.0), 1e-8);

    final Function1D<DoubleMatrix1D, Double> params_func = VECTOR_PARAMS.asFunctionOfParameters(1.0);
    final ScalarFieldFirstOrderDifferentiator vdiff = new ScalarFieldFirstOrderDifferentiator();
    final Function1D<DoubleMatrix1D, DoubleMatrix1D> vgrad = vdiff.differentiate(params_func);
View Full Code Here


  }

  @Test
  public void testDerivative() {
    final Function1D<Double, Double> func = CURVE_NS.toFunction1D();
    final ScalarFirstOrderDifferentiator diff = new ScalarFirstOrderDifferentiator();
    final Function1D<Double, Double> grad = diff.differentiate(func);

    for (int i = 0; i < 50; i++) {
      final double t = 0 + 10.0 * i / 99.;
      final double fd = grad.evaluate(t);
      final double anal = CURVE_NS.getDyDx(t);
View Full Code Here

TOP

Related Classes of com.opengamma.analytics.math.differentiation.ScalarFirstOrderDifferentiator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.