function [x, fevals] = secant(F, a, b, tol)
%SECANT Secant zero-finding method for function F on the interval [a,b].
%       Return the converged value x and the number of function evaluations.
    fevals = 0;
    while abs(b - a) > tol
        c = a;
        a = b;
        b = a + (a - c)/(F(c)/F(a) - 1.);
        fevals = fevals + 2;
    end
    x = b;
end
