Package org.jquantlib.math.solvers1D

Examples of org.jquantlib.math.solvers1D.Secant


      public double derivative (final double x) {
        return 2*x;
      }
    };

    final Secant secant = new Secant();

    double root = secant.solve(f, accuracy, guess, xMin, xMax);

    if (Math.abs(1.0-root)> accuracy) {
      fail("expected: 1.0" + " but root is: " + root);
    }

    if(secant.getMaxEvaluations() != 100){
      fail("expected: 100" + " but was: " + secant.getMaxEvaluations());
    }

    root = secant.solve(f, accuracy, 0.01, 0.1);

    if (Math.abs(1.0-root)> accuracy) {
      fail("expected: 1.0" + " but root is: " + root);
    }
  }
View Full Code Here

TOP

Related Classes of org.jquantlib.math.solvers1D.Secant

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.