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

  it = 0;
  
  while ( true )
    it = it + 1;
    c = ( a * f(b) - b * f(a) ) / ( f(b) - f(a) );
    alpha = abs ( c - b ) / abs ( b - a );
    a = b;
    b = c;
    if ( abs ( f(b) ) <= ftol && abs ( a - b ) <= xtol )
      return
    end
    if ( itmax <= it )
      return;
    end
  end
  
  return
end
