/***********************************************************
Author: Martin van der Ende <MVDENDE@fee.uva.nl>
Date: 20 Sep 1996
Subject:       zero of a function
This code is provided free, without performance guarantees,
for public non-commercial use.

Finding a zero of a function:
if you have a reasonable guess for an initial value,
you do not have to call a complete package but can just include a few
lines in your program. This is especially advantageous if you are
actually looking for a matrix of zeros. For example if you want
several probability contours as a function of a parameter, or if you
want to solve first order conditions for different respondents at
different times:

This is also the approach in Baird's inverse CDFs, and the above
approach also worked well and fast in some of my applications.
***********************************************************/

root=guess;
fun=10;
do while ABS(fun)>1E-6;
    fun = f(root)
    dfun = df(root);
    root=root-fun./dfun;
endo;

