Class NewtonsMethod
java.lang.Object
net.finmath.rootfinder.NewtonsMethod
- All Implemented Interfaces:
RootFinderWithDerivative
- Direct Known Subclasses:
SecantMethod
This class implements a root finder as question-and-answer algorithm
using Newton's method.
- Version:
- 1.3
- Author:
- Christian Fries
- Date:
- 2008-04-06
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoubledoubledoubleintbooleanisDone()voidsetValueAndDerivative(double value, double derivative)
-
Constructor Details
-
NewtonsMethod
public NewtonsMethod(double guess) - Parameters:
guess- initial guess where the solver will start
-
-
Method Details
-
getBestPoint
public double getBestPoint()- Specified by:
getBestPointin interfaceRootFinderWithDerivative- Returns:
- Returns the best point optained so far
-
getNextPoint
public double getNextPoint()- Specified by:
getNextPointin interfaceRootFinderWithDerivative- Returns:
- Next point for which a value should be set using
setValue.
-
setValueAndDerivative
public void setValueAndDerivative(double value, double derivative) - Specified by:
setValueAndDerivativein interfaceRootFinderWithDerivative- Parameters:
value- The value corresponding to the point returned by previousgetNextPointcall.derivative- The derivative corresponding to the point returned by previousgetNextPointcall.
-
getNumberOfIterations
public int getNumberOfIterations()- Specified by:
getNumberOfIterationsin interfaceRootFinderWithDerivative- Returns:
- Returns the number of iterations.
-
getAccuracy
public double getAccuracy()- Specified by:
getAccuracyin interfaceRootFinderWithDerivative- Returns:
- Returns the accuracy.
-
isDone
public boolean isDone()- Specified by:
isDonein interfaceRootFinderWithDerivative- Returns:
- Returns true if the solver is done (accuracy achieved or unable to improve)
-