a=0;
b=pi/2;

Fa=sqrt(a)-cos(a);
Fb=sqrt(b)-cos(b);

for i=1:10
  c=(a+b)/2;         
  Fc=sqrt(c)-cos(c); 
  if Fa*Fc<0
    b=c;             
  else
    a=c;             
  end
end

x=(a+b)/2