finMath lib documentation
net.finmath.rootfinder

## Class NewtonsMethod

• All Implemented Interfaces:
RootFinderWithDerivative
Direct Known Subclasses:
SecantMethod

public class NewtonsMethod
extends Object
implements RootFinderWithDerivative
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
Constructor and Description
NewtonsMethod(double guess)
• ### Method Summary

All Methods
Modifier and Type Method and Description
double getAccuracy()
double getBestPoint()
double getNextPoint()
int getNumberOfIterations()
boolean isDone()
void setValueAndDerivative(double value, double derivative)
• ### Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
• ### Constructor Detail

• #### NewtonsMethod

public NewtonsMethod(double guess)
Parameters:
guess - initial guess where the solver will start
• ### Method Detail

• #### getBestPoint

public double getBestPoint()
Specified by:
getBestPoint in interface RootFinderWithDerivative
Returns:
Returns the best point optained so far
• #### getNextPoint

public double getNextPoint()
Specified by:
getNextPoint in interface RootFinderWithDerivative
Returns:
Next point for which a value should be set using setValue.
• #### setValueAndDerivative

public void setValueAndDerivative(double value,
double derivative)
Specified by:
setValueAndDerivative in interface RootFinderWithDerivative
Parameters:
value - The value corresponding to the point returned by previous getNextPoint call.
derivative - The derivative corresponding to the point returned by previous getNextPoint call.
• #### getNumberOfIterations

public int getNumberOfIterations()
Specified by:
getNumberOfIterations in interface RootFinderWithDerivative
Returns:
Returns the number of iterations.
• #### getAccuracy

public double getAccuracy()
Specified by:
getAccuracy in interface RootFinderWithDerivative
Returns:
Returns the accuracy.
• #### isDone

public boolean isDone()
Specified by:
isDone in interface RootFinderWithDerivative
Returns:
Returns true if the solver is done (accuracy achieved or unable to improve)