com.cedarspring.tvm
Class FindRoot

java.lang.Object
  |
  +--com.cedarspring.tvm.FindRoot
All Implemented Interfaces:
java.io.Serializable

public final class FindRoot
extends java.lang.Object
implements java.io.Serializable

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.

Version:
1.2.2 15-May-2003
Author:
Cedar Spring Software, Inc.
See Also:
Serialized Form

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

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

FindRoot

public FindRoot()
Construct a FindRoot object

Method Detail

evaluate

public java.math.BigDecimal evaluate(java.math.BigDecimal estimate,
                                     java.math.BigDecimal error,
                                     Solve s,
                                     Options o)
                              throws TVMException
Find the zero root of a function

Parameters:
estimate - An initial estimate
error - error limit
s - A Solve object that can calculate f(x) and the first derivative of f(x).
o - Scale and rounding options
Throws:
TVMException - Throws and exception with error number