## org.apache.commons.math3.analysis.solvers
Class NewtonRaphsonSolver

    java.lang.Object
      org.apache.commons.math3.analysis.solvers.BaseAbstractUnivariateSolver<UnivariateDifferentiableFunction>
          org.apache.commons.math3.analysis.solvers.AbstractUnivariateDifferentiableSolver
              org.apache.commons.math3.analysis.solvers.NewtonRaphsonSolver

All Implemented Interfaces:
  BaseUnivariateSolver<UnivariateDifferentiableFunction>, UnivariateDifferentiableSolver

    public class NewtonRaphsonSolver

extends AbstractUnivariateDifferentiableSolver

Implements Newton's Method for finding zeros of real univariate differentiable functions.

Since:
  3.1
Version:
  $Id: NewtonRaphsonSolver.java 1383441 2012-09-11 14:56:39Z luc $

Field Summary
`private static double` `DEFAULT_ABSOLUTE_ACCURACY` Default absolute accuracy.

Constructor Summary
`NewtonRaphsonSolver()` Construct a solver.
`NewtonRaphsonSolver(double absoluteAccuracy)` Construct a solver.

Method Summary
`protected double` `doSolve()` Method for implementing actual optimization algorithms in derived classes.
`double` `solve(int maxEval, UnivariateDifferentiableFunction f, double min, double max)` Find a zero near the midpoint of `min` and `max`.

Methods inherited from class org.apache.commons.math3.analysis.solvers.AbstractUnivariateDifferentiableSolver
`computeObjectiveValueAndDerivative, setup`

Methods inherited from class org.apache.commons.math3.analysis.solvers.BaseAbstractUnivariateSolver
`computeObjectiveValue, getAbsoluteAccuracy, getEvaluations, getFunctionValueAccuracy, getMax, getMaxEvaluations, getMin, getRelativeAccuracy, getStartValue, incrementEvaluationCount, isBracketing, isSequence, solve, solve, verifyBracketing, verifyInterval, verifySequence`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.apache.commons.math3.analysis.solvers.BaseUnivariateSolver
`getAbsoluteAccuracy, getEvaluations, getFunctionValueAccuracy, getMaxEvaluations, getRelativeAccuracy, solve, solve`

Field Detail

### DEFAULT_ABSOLUTE_ACCURACY

    private static final double DEFAULT_ABSOLUTE_ACCURACY

  Default absolute accuracy.

  See Also:
    Constant Field Values

Constructor Detail

### NewtonRaphsonSolver

    public NewtonRaphsonSolver()

  Construct a solver.

### NewtonRaphsonSolver

    public NewtonRaphsonSolver(double absoluteAccuracy)

  Construct a solver.

  Parameters:
    `absoluteAccuracy` - Absolute accuracy.

Method Detail

### solve

    public double solve(int maxEval,
                        UnivariateDifferentiableFunction f,
                        double min,
                        double max)
                 throws TooManyEvaluationsException

  Find a zero near the midpoint of `min` and `max`.

  Specified by:
    `solve` in interface `BaseUnivariateSolver<UnivariateDifferentiableFunction>`
  Overrides:
    `solve` in class `BaseAbstractUnivariateSolver<UnivariateDifferentiableFunction>`
  Parameters:
    `f` - Function to solve.
    `min` - Lower bound for the interval.
    `max` - Upper bound for the interval.
    `maxEval` - Maximum number of evaluations.
  Returns:
    the value where the function is zero.
  Throws:
    `TooManyEvaluationsException` - if the maximum evaluation count is exceeded.
    `NumberIsTooLargeException` - if `min >= max`.

### doSolve

    protected double doSolve()
                      throws TooManyEvaluationsException

  Method for implementing actual optimization algorithms in derived classes.

  Specified by:
    `doSolve` in class `BaseAbstractUnivariateSolver<UnivariateDifferentiableFunction>`
  Returns:
    the root.
  Throws:
    `TooManyEvaluationsException` - if the maximal number of evaluations is exceeded.

Copyright (c) 2003-2013 Apache Software Foundation