Package org.apache.commons.math.analysis.solvers

Examples of org.apache.commons.math.analysis.solvers.BrentSolver.solve()


    double root;
    int iterations;
    double estimatedPrecision = DoubleVector.EPSILON; // not exposed by commons math impl

    try {
      root = solver.solve(maximumIterations, new UnivariateRealClosure(context, rho, fn), lower, upper);
      iterations = 1; // the Commons math impl doesn't expose this
    } catch (MaxIterationsExceededException e) {
      root = DoubleVector.NA;
      iterations = -1;
    } catch (FunctionEvaluationException e) {
View Full Code Here


                    }

                    final double root;
                    try {
                        root = (ta <= tb) ?
                                solver.solve(maxIterationCount, f, ta, tb) :
                                    solver.solve(maxIterationCount, f, tb, ta);
                    } catch (FunctionEvaluationException ex) {
                        throw new DerivativeException(ex);
                    }
View Full Code Here

                    final double root;
                    try {
                        root = (ta <= tb) ?
                                solver.solve(maxIterationCount, f, ta, tb) :
                                    solver.solve(maxIterationCount, f, tb, ta);
                    } catch (FunctionEvaluationException ex) {
                        throw new DerivativeException(ex);
                    }

                    if ((!Double.isNaN(previousEventTime)) &&
View Full Code Here

                    final BrentSolver solver = new BrentSolver();
                    solver.setAbsoluteAccuracy(convergence);
                    solver.setMaximalIterationCount(maxIterationCount);
                    double root;
                    try {
                        root = (ta <= tb) ? solver.solve(f, ta, tb) : solver.solve(f, tb, ta);
                    } catch (IllegalArgumentException iae) {
                        // the interval did not really bracket a root
                        root = Double.NaN;
                    }
                    if (Double.isNaN(root) ||
View Full Code Here

                    final BrentSolver solver = new BrentSolver();
                    solver.setAbsoluteAccuracy(convergence);
                    solver.setMaximalIterationCount(maxIterationCount);
                    double root;
                    try {
                        root = (ta <= tb) ? solver.solve(f, ta, tb) : solver.solve(f, tb, ta);
                    } catch (IllegalArgumentException iae) {
                        // the interval did not really bracket a root
                        root = Double.NaN;
                    }
                    if (Double.isNaN(root) ||
View Full Code Here

                        }
                    };
                    final BrentSolver solver = new BrentSolver();
                    solver.setAbsoluteAccuracy(convergence);
                    solver.setMaximalIterationCount(maxIterationCount);
                    final double root = (ta <= tb) ? solver.solve(f, ta, tb) : solver.solve(f, tb, ta);
                    if ((Math.abs(root - ta) <= convergence) &&
                         (Math.abs(root - previousEventTime) <= convergence)) {
                        // we have either found nothing or found (again ?) a past event, we simply ignore it
                        ta = tb;
                        ga = gb;
View Full Code Here

                        }
                    };
                    final BrentSolver solver = new BrentSolver();
                    solver.setAbsoluteAccuracy(convergence);
                    solver.setMaximalIterationCount(maxIterationCount);
                    final double root = (ta <= tb) ? solver.solve(f, ta, tb) : solver.solve(f, tb, ta);
                    if ((Math.abs(root - ta) <= convergence) &&
                         (Math.abs(root - previousEventTime) <= convergence)) {
                        // we have either found nothing or found (again ?) a past event, we simply ignore it
                        ta = tb;
                        ga = gb;
View Full Code Here

    // We solve the equation define by the function and use the result to calculate values, nodes are also calculates.
    final UnivariateRealFunction f = CommonsMathWrapper.wrapUnivariate(function);
    double growth;
    try {
      growth = solver.solve(f, -.5, .5, initialGuess);

      for (int loopmonth = 1; loopmonth < NB_MONTH; loopmonth++) {
        nodes[loopmonth] = x1 + loopmonth * (x2 - x1) / 12.0;
        values[loopmonth] = values[loopmonth - 1] * (1 + growth + _seasonalValues[loopmonth]);
      }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.