function c = bisect0(a,b)
% BISECT0 initial implementation of bisection following
%    pp 76-78 of Kincaid&Cheney, for equation
%       cos(x) - x = 0
% compare bisect1.m and bisect.m

u = cos(a) - a;
v = cos(b) - b;
e = b - a;

for k = 1:50
  e = e / 2.0;
  c = a + e;
  w = cos(c) - c;
  if sign(w) ~= sign(u)
    b = c;
    v = w;
  else
    a = c;
    u = w;
  end
end

