%demobisect2.m
clear
% search between a and b
a = input ('enter lower limit')
b = input ('enter upper limit')
tol = 1.E-6;
while ((b-a)>tol)
   m = (a+b)/2;
   if (sign(demfun2(a))==sign(demfun2(m)))
      a = m;
   else
      b = m;
   end
   fprintf('\na= %f b= %f f(a)=%E f(b)=%E',a,b,demfun2(a),demfun2(b))
end
