def zps(f,a,b): assert a0 while abs(b-a)>1e-12: (a,b) = (b,b-(b-a)/(f(b)-f(a))*f(b)) return (a+b)/2