An implementation of the secant method for finding roots of a function