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
ConstructorsConstructorDescriptionConstruct a solver.NewtonRaphsonSolver(double absoluteAccuracy) Construct a solver. -
Method Summary
Modifier and TypeMethodDescriptionprotected doubledoSolve()Method for implementing actual optimization algorithms in derived classes.doublesolve(int maxEval, UnivariateDifferentiableFunction f, double min, double max) Find a zero near the midpoint ofminandmax.Methods inherited from class org.hipparchus.analysis.solvers.AbstractUnivariateDifferentiableSolver
computeObjectiveValueAndDerivative, setupMethods inherited from class org.hipparchus.analysis.solvers.BaseAbstractUnivariateSolver
computeObjectiveValue, getAbsoluteAccuracy, getEvaluations, getFunctionValueAccuracy, getMax, getMin, getRelativeAccuracy, getStartValue, incrementEvaluationCount, isBracketing, isSequence, solve, solve, verifyBracketing, verifyInterval, verifySequenceMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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 ofminandmax.- Specified by:
solvein interfaceBaseUnivariateSolver<UnivariateDifferentiableFunction>- Overrides:
solvein classBaseAbstractUnivariateSolver<UnivariateDifferentiableFunction>- Parameters:
maxEval- Maximum number of evaluations.f- Function to solve.min- Lower bound for the interval.max- Upper bound for the interval.- 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:
doSolvein classBaseAbstractUnivariateSolver<UnivariateDifferentiableFunction>- Returns:
- the root.
- Throws:
MathIllegalStateException- if the maximal number of evaluations is exceeded.
-