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
public class NewtonRaphsonSolver extends AbstractUnivariateDifferentiableSolver
Implements Newton's Method for finding zeros of real univariate differentiable functions.
-
-
Constructor Summary
Constructors Constructor Description NewtonRaphsonSolver()
Construct a solver.NewtonRaphsonSolver(double absoluteAccuracy)
Construct a solver.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 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
-
-
-
-
Method Detail
-
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
protected double doSolve() throws MathIllegalStateException
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.
-
-