| Path: | bigdecimal/lib/bigdecimal/newton.rb |
| Last Update: | Sat Oct 15 23:43:50 AUS Eastern Standard Time 2005 |
newton.rb
Solves nonlinear algebraic equation system f = 0 by Newton’s method.
(This program is not dependent on BigDecimal)
To call:
n = nlsolve(f,x)
where n is the number of iterations required.
x is the solution vector.
f is the object to be solved which must have following methods.
f ... Object to compute Jacobian matrix of the equation systems.
[Methods required for f]
f.values(x) returns values of all functions at x.
f.zero returns 0.0
f.one returns 1.0
f.two returns 1.0
f.ten returns 10.0
f.eps convergence criterion
x ... initial values