code: def find_zero_bisect(f, xmin, xmax, xprecision):
      
      if f(xmax)*f(xmin) > 0:
          print("find_zero_bisect(): no zero on the range",xmin,"to",xmax)
          return None
  
      temp = min(xmin,xmax)
      xmax = max(xmin,xmax)
      xmin = temp
  
      xmid = (xmin+xmax)*0.5
      while xmax-xmin > xprecision:
          y = f(xmid)
  
          # pick the direction with one guy above and one guy below zero
          if y > 0:
              # move left or right?
              if f(xmin) < 0: xmax=xmid
              else:           xmin=xmid
  
          # f(xmid) is below zero
          elif y < 0:
              # move left or right?
              if f(xmin) > 0: xmax=xmid
              else:           xmin=xmid
  
          # yeah, right
          else: return xmid
  
          # bisect again
          xmid = (xmin+xmax)*0.5
  
      return xmid
docs: This will bisect the range and zero in on zero.