% BISECTXCOSX solves   x-cos(x) = 0  by bisection

format long

a=0;
b=1;

for n=1:52
  p = (a+b)/2
  if p - cos(p) < 0
    a = p;
  else
    b = p;
  end
end

