@PublicationReference(author={"William H. Press","Saul A. Teukolsky","William T. Vetterling","Brian P. Flannery"}, title="Numerical Recipes in C, Second Edition", type=Book, year=1992, pages={169,171}, url="http://www.nrbook.com/a/bookcpdf.php") public class LentzMethod extends AbstractAnytimeAlgorithm<java.lang.Double>
maxIterations
DEFAULT_ITERATION, iteration
Constructor and Description |
---|
LentzMethod()
Creates a new instance of LentzMethod
|
LentzMethod(int maxIterations,
double tolerance,
double minDenominator)
Creates a new instance of LentzMethod
|
Modifier and Type | Method and Description |
---|---|
double |
getFractionValue()
Getter for fractionValue
|
boolean |
getKeepGoing()
Getter for keepGoing
|
double |
getMinDenominator()
Getter for minDenominator
|
java.lang.Double |
getResult()
Gets the current result of the algorithm.
|
double |
getTolerance()
Getter for tolerance
|
boolean |
initializeAlgorithm(double b0)
Initializes Lentz's method using the given values
|
boolean |
iterate(double a,
double b)
Step of Lentz's iteration
|
protected void |
setFractionValue(double fractionValue)
Setter for fractionValue
|
void |
setMinDenominator(double minDenominator)
Setter for minDenominator
|
void |
setTolerance(double tolerance)
Setter for tolerance
|
void |
stop()
Requests that the algorithm stop at the next appropriate point.
|
getMaxIterations, isResultValid, setMaxIterations
addIterativeAlgorithmListener, clone, fireAlgorithmEnded, fireAlgorithmStarted, fireStepEnded, fireStepStarted, getIteration, getListeners, removeIterativeAlgorithmListener, setIteration, setListeners
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
addIterativeAlgorithmListener, getIteration, removeIterativeAlgorithmListener
public LentzMethod()
public LentzMethod(int maxIterations, double tolerance, double minDenominator)
maxIterations
- Maximum number of iterations before stoppingtolerance
- Tolerance of the algorithm for convergenceminDenominator
- Value to keep denominators from equaling 0.0public boolean initializeAlgorithm(double b0)
b0
- Initial "b" coefficient of the continued fractionpublic boolean iterate(double a, double b)
a
- coefficient "a" from the next recursion of the continued fractionb
- coefficient "b" from the next recursion of the continued fractionpublic double getTolerance()
public void setTolerance(double tolerance)
tolerance
- Tolerance of the algorithm for convergencepublic double getMinDenominator()
public void setMinDenominator(double minDenominator)
minDenominator
- Value to keep denominators from equaling 0.0public java.lang.Double getResult()
AnytimeAlgorithm
public void stop()
StoppableAlgorithm
public boolean getKeepGoing()
public double getFractionValue()
protected void setFractionValue(double fractionValue)
fractionValue
- Running (intermediate) value of the fraction value