Package org.hipparchus.analysis.solvers
Class NewtonRaphsonSolver
java.lang.Object
org.hipparchus.analysis.solvers.BaseAbstractUnivariateSolver<UnivariateDifferentiableFunction>
org.hipparchus.analysis.solvers.AbstractUnivariateDifferentiableSolver
org.hipparchus.analysis.solvers.NewtonRaphsonSolver
- All Implemented Interfaces:
BaseUnivariateSolver<UnivariateDifferentiableFunction>
,UnivariateDifferentiableSolver
Implements
Newton's Method for finding zeros of real univariate differentiable
functions.
-
Constructor Summary
ConstructorDescriptionConstruct a solver.NewtonRaphsonSolver
(double absoluteAccuracy) Construct a solver. -
Method Summary
Modifier and TypeMethodDescriptionprotected 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 ofmin
andmax
.Methods inherited from class org.hipparchus.analysis.solvers.AbstractUnivariateDifferentiableSolver
computeObjectiveValueAndDerivative, setup
Methods inherited from class org.hipparchus.analysis.solvers.BaseAbstractUnivariateSolver
computeObjectiveValue, getAbsoluteAccuracy, getEvaluations, getFunctionValueAccuracy, getMax, 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.hipparchus.analysis.solvers.BaseUnivariateSolver
getAbsoluteAccuracy, getEvaluations, getFunctionValueAccuracy, getRelativeAccuracy, solve, solve
-
Constructor Details
-
NewtonRaphsonSolver
public NewtonRaphsonSolver()Construct a solver. -
NewtonRaphsonSolver
public NewtonRaphsonSolver(double absoluteAccuracy) Construct a solver.- Parameters:
absoluteAccuracy
- Absolute accuracy.
-
-
Method Details
-
solve
public double solve(int maxEval, UnivariateDifferentiableFunction f, double min, double max) throws MathIllegalStateException Find a zero near the midpoint ofmin
andmax
.- Specified by:
solve
in interfaceBaseUnivariateSolver<UnivariateDifferentiableFunction>
- Overrides:
solve
in classBaseAbstractUnivariateSolver<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:
MathIllegalStateException
- if the maximum evaluation count is exceeded.MathIllegalArgumentException
- ifmin >= max
.
-
doSolve
Method for implementing actual optimization algorithms in derived classes.- Specified by:
doSolve
in classBaseAbstractUnivariateSolver<UnivariateDifferentiableFunction>
- Returns:
- the root.
- Throws:
MathIllegalStateException
- if the maximal number of evaluations is exceeded.
-