Package org.apache.commons.math.analysis

Examples of org.apache.commons.math.analysis.UnivariateRealSolver


                synchronized (this) {
                    if (sf == null) {
                        sf = UnivariateRealSolverFactory.newInstance();
                    }
                }
                UnivariateRealSolver solver = sf.newDefaultSolver(f);

                double sign = Math.signum(f.value(x[0]));
                for (int i = 1; i < n; i++) {
                    double isig = Math.signum(f.value(x[i]));
                    if (isig != sign) {
                        zeros.add(solver.solve(x[i - 1], x[i]));
                        sign = isig;
                    }
                }
            }
            return zeros;
View Full Code Here


          // there is a sign change: an event is expected during this step

          // variation direction, with respect to the integration direction
          increasing = (gb >= ga);

          UnivariateRealSolver solver = new BrentSolver(new UnivariateRealFunction() {
              public double value(double t) throws FunctionEvaluationException {
                  try {
                      interpolator.setInterpolatedTime(t);
                      return function.g(t, interpolator.getInterpolatedState());
                  } catch (DerivativeException e) {
                      throw new FunctionEvaluationException(t, e);
                  }
              }
          });
          solver.setAbsoluteAccuracy(convergence);
          solver.setMaximalIterationCount(maxIterationCount);
          double root = solver.solve(ta, tb);
          if (Double.isNaN(previousEventTime) || (Math.abs(previousEventTime - root) > convergence)) {
              pendingEventTime = root;
              if (pendingEvent && (Math.abs(t1 - pendingEventTime) <= convergence)) {
                  // we were already waiting for this event which was
                  // found during a previous call for a step that was
View Full Code Here

TOP

Related Classes of org.apache.commons.math.analysis.UnivariateRealSolver

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.