code: def compute_lower_limit(mu_in, post, alpha=0.9):
      
      if 0 < alpha < 1:
          dp = integral_element(mu_in, post)
          low_idx = bisect.bisect_right(dp.cumsum() / dp.sum(), 1 - alpha)
          # if alpha is in [0,1) and post is non-negative, bisect_right
          # will always return an index in the range of mu since
          # post.cumsum()/post.sum() will always begin at 0 and end at 1
          mu_low = mu_in[low_idx]
      elif alpha == 1:
          mu_low = numpy.min(mu_in[post > 0])
      else:
          raise ValueError("Confidence level must be in (0,1].")
  
      return mu_low
docs: Returns the lower limit mu_low of confidence level alpha for a
      posterior distribution post on the given parameter mu.
      The posterior need not be normalized.