functions in roots.i - f

f_inverse

f_inverse(f_and_dfdx, y, x0, x1, xerr)
or f_inverse(f_and_dfdx, y, x0, x1, xerr)
Find values of an inverse 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 the input x is an array, the returned f and dfdx must have
the same shape as the input x. If F_AND_DFDX always returns
zero dfdx, f_inverse will use bisection.
The result x will have the same shape as the input Y values.
The values of x are constrained to lie within the interval from
X0 to X1; the function value must be on opposite sides of the
required Y at these interval endpoints. The iteration stops
when the root is known to within XERR, or to machine precision
if XERR is nil or zero. X0, X1, and XERR may be arrays conformable
with Y.
f_inverse takes the same number of iterations for every Y value;
it does not notice that some may have converged before others.
Interpreted function, defined at i/roots.i line 102