java.lang.Object | +--com.cedarspring.tvm.FindRoot
Solves f(x) = 0 using Newton-Ralphson method. Given an initial estimate of the root (for instance, an interest rate), this class will generate a sequence of approximations that converge on the actual root until it is within an acceptable error range.
This method may fail to converge toward the root or fail to do so within a specified number of iterations. In that case a new attempt should be made with a different (hopefully more accurate) estimate.
| Field Summary | |
(package private) static long |
serialVersionUID
|
| Constructor Summary | |
FindRoot()
Construct a FindRoot object |
|
| Method Summary | |
java.math.BigDecimal |
evaluate(java.math.BigDecimal estimate,
java.math.BigDecimal error,
Solve s,
Options o)
Find the zero root of a function |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
static final long serialVersionUID
| Constructor Detail |
public FindRoot()
| Method Detail |
public java.math.BigDecimal evaluate(java.math.BigDecimal estimate,
java.math.BigDecimal error,
Solve s,
Options o)
throws TVMException
estimate - An initial estimateerror - error limits - A Solve object that can calculate f(x)
and the first derivative of f(x).o - Scale and rounding options
TVMException - Throws and exception with error number