| Path: | bigdecimal/lib/bigdecimal/newton.rb |
| Last Update: | Tue Mar 13 02:04:06 -0500 2007 |
newton.rb
Solves the 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 initial value vector
f is an Object which is used to compute the values of the equations to be solved.
It must provide the following methods:
| f.values(x): | returns the 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: | returns the convergence criterion (epsilon value) used to determine whether two values are considered equal. If |a-b| < epsilon, the two values are considered equal. |
On exit, x is the solution vector.
ruby-doc.org is a community service provided by James Britt and Happy Camper Studios, a Phoenix, Arizona, Ruby application development company.
Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.
For more information on the Ruby programming language, visit ruby-lang.org.
Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.