nraphson
|
nraphson(f_and_dfdx, x0, x1)
or nraphson(f_and_dfdx, x0, x1, xerr)
Find a root of a function by Newton-Raphson iteration, backed
up by bisection if the convergence seems poor. The subroutine
F_AND_DFDX must be defined as:
func F_AND_DFDX (x, &f, &dfdx)
returning both the function value f(x) and derivative dfdx(x).
If F_AND_DFDX always returns dfdx==0, nraphson uses bisection.
The value of x is constrained to lie within the interval from
X0 to X1; the function values at these two points must have
opposite sign. The iteration stops when the root is known to
within XERR, or to machine precision if XERR is nil or zero.
f_inverse is a "vectorized" version of nraphson.
Based on rtsafe from Press, et. al. Numerical Recipes, Ch 9.
interpreted function, defined at i/roots.i line 21
|