function [ a, b, it ] = secant2 ( f, a, b, xtol, ftol, itmax )

  it = 0;
  alpha = 0.0;
  
  while ( true )
    it = it + 1;
    c = ( a * f(b) - b * f(a) ) / ( f(b) - f(a) );
    alpha_old = alpha;
    alpha = abs ( c - b ) / abs ( b - a );
    if ( 0 < alpha_old )
      r = log ( alpha ) / log ( alpha_old );
      fprintf ( '%d: alpha = %g, log(alpha)= %g, r = %g\n', it, alpha, log(alpha), r );
    else
      fprintf ( '%d: alpha = %g, log(alpha)= %g\n', it, alpha, log(alpha) );
    end
    a = b;
    b = c;
    if ( abs ( f(b) ) <= ftol && abs ( a - b ) <= xtol )
      return
    end
    if ( itmax <= it )
      return;
    end
  end
  
  return
end
