Top Description Fields Constructors Methods
org.apache.commons.math3.analysis.solvers

public Class NewtonRaphsonSolver

extends AbstractUnivariateDifferentiableSolver
Class Inheritance
Imports
org.apache.commons.math3.analysis.differentiation.DerivativeStructure, .UnivariateDifferentiableFunction, org.apache.commons.math3.util.FastMath, org.apache.commons.math3.exception.TooManyEvaluationsException

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

Field Summary

Modifier and TypeField and Description
private static final double
DEFAULT_ABSOLUTE_ACCURACY

Default absolute accuracy.

Constructor Summary

AccessConstructor and Description
public
NewtonRaphsonSolver()

Construct a solver.

public
NewtonRaphsonSolver(double
Absolute accuracy.
absoluteAccuracy
)

Construct a solver.

Method Summary

Modifier and TypeMethod and Description
protected double
doSolve()

Implements abstract org.apache.commons.math3.analysis.solvers.BaseAbstractUnivariateSolver.doSolve.

Method for implementing actual optimization algorithms in derived classes.

public double

Returns:

the value where the function is zero.
solve
(int
Maximum number of evaluations.
maxEval
,
final UnivariateDifferentiableFunction
Function to solve.
f
,
final double
Lower bound for the interval.
min
,
final double
Upper bound for the interval.
max
)

Overrides org.apache.commons.math3.analysis.solvers.BaseAbstractUnivariateSolver.solve.

Implements org.apache.commons.math3.analysis.solvers.BaseUnivariateSolver.solve.

Find a zero near the midpoint of min and max.

Inherited from org.apache.commons.math3.analysis.solvers.AbstractUnivariateDifferentiableSolver:
computeObjectiveValueAndDerivativesetup

Field Detail

DEFAULT_ABSOLUTE_ACCURACYback to summary
private static final double DEFAULT_ABSOLUTE_ACCURACY

Default absolute accuracy.

Constructor Detail

NewtonRaphsonSolverback to summary
public NewtonRaphsonSolver()

Construct a solver.

NewtonRaphsonSolverback to summary
public NewtonRaphsonSolver(double absoluteAccuracy)

Construct a solver.

Parameters
absoluteAccuracy:double

Absolute accuracy.

Method Detail

doSolveback to summary
protected double doSolve() throws TooManyEvaluationsException

Implements abstract org.apache.commons.math3.analysis.solvers.BaseAbstractUnivariateSolver.doSolve.

Doc from org.apache.commons.math3.analysis.solvers.BaseAbstractUnivariateSolver.doSolve.

Method for implementing actual optimization algorithms in derived classes.

Returns:double

the root.

Annotations
@Override
Exceptions
TooManyEvaluationsException:
if the maximal number of evaluations is exceeded.
solveback to summary
public double solve(int maxEval, final UnivariateDifferentiableFunction f, final double min, final double max) throws TooManyEvaluationsException

Overrides org.apache.commons.math3.analysis.solvers.BaseAbstractUnivariateSolver.solve.

Implements org.apache.commons.math3.analysis.solvers.BaseUnivariateSolver.solve.

Find a zero near the midpoint of min and max.

Parameters
maxEval:int

Maximum number of evaluations.

f:UnivariateDifferentiableFunction

Function to solve.

min:double

Lower bound for the interval.

max:double

Upper bound for the interval.

Returns:double

the value where the function is zero.

Annotations
@Override
Exceptions
TooManyEvaluationsException:
if the maximum evaluation count is exceeded.
NumberIsTooLargeException:
if min >= max.