function bisect(a,b) c=0 for i=1:10 c=(a+b)/2 y=f(c) if y<0 println("updating a with ",c) a=c else println("updating b with ",c) b=c end end return a,b end f(x)=x^2-2 bisect(0.0,2.0)