function [b, k, vec] = mysecant(f, a, b)
    %MYSECANT mysecant(f,a,b) reduces the interval [a,b] to a tiny
    % interal on which the function f(x) changes sign.
    % Returns one end point of that interval, the number
    % of function evaluations, and the vector of approximations
 
    vec = [];
    fa = f(a);
    fb = f(b);
    if sign(fa) == sign(fb)
       error('f(x) must change sign on the interval [a,b].')
    end
    k = 2;
    
	while abs(b - a) > eps*abs(b)
		c = a;
        fc = fa;
		a = b;
        fa = fb;
		b = a + (a - c)/(fc/fa - 1.);
        fb = f(b);
		k = k + 1;
        vec = [vec b];
    end
end

