code: def invert_increasing_function(f, f0, xmin, xmax, tolerance, max_iterations=100):
      
  
      for n in range(max_iterations):
          # start at the middle
          x = 0.5*(xmin+xmax)
  
          df = f(x)-f0
          if _n.fabs(df) < tolerance: return x
  
          # if we're high, set xmin to x etc...
          if df > 0: xmin=x
          else:      xmax=x
  
      print("Couldn't find value!")
      return 0.5*(xmin+xmax)
docs: This will try try to qickly find a point on the f(x) curve between xmin and xmax that is
      equal to f0 within tolerance.