newton.rb
| Path: | bigdecimal/newton.rb |
| Last Update: | Wed Jul 26 21:33:41 BST 2006 |
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