net.finmath.rootfinder
Class NewtonsMethod
- java.lang.Object
-
- net.finmath.rootfinder.NewtonsMethod
-
- All Implemented Interfaces:
- RootFinderWithDerivative
- Direct Known Subclasses:
- SecantMethod
public class NewtonsMethod extends java.lang.Object implements RootFinderWithDerivative
This class implements a root finder as question-and-answer algorithm using Newton's method.
-
-
Constructor Summary
Constructors Constructor and Description NewtonsMethod(double guess)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doublegetAccuracy()doublegetBestPoint()doublegetNextPoint()intgetNumberOfIterations()booleanisDone()voidsetValueAndDerivative(double value, double derivative)
-
-
-
Constructor Detail
-
NewtonsMethod
public NewtonsMethod(double guess)
- Parameters:
guess- initial guess where the solver will start
-
-
Method Detail
-
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)
-
-
DataMelt 3.0 © DataMelt by jWork.ORG