def zpd(f,a,b): assert a0 while b-a>1e-6: m=(a+b)/2 if f(m)<0: a = m else: b = m return (a+b)/2