function value = bisection(a,b,n)
f=inline('cos(x)-x','x');
fleft = f(a); 
fright = f(b);
for k=1:n
    m(k) = (a+b)/2;
    fmid = f(m(k));
    if fmid*fleft > 0
        a = m(k);
    else
        b = m(k);
    end
end
value = m;

