code: def integral_element(mu, pdf):
      '''
      Returns an array of elements of the integrand dP = p(mu) dmu
      for a density p(mu) defined at sample values mu ; samples need
      not be equally spaced.  Uses a simple trapezium rule.
      Number of dP elements is 1 - (number of mu samples).
      '''
      dmu = mu[1:] - mu[:-1]
      bin_mean = (pdf[1:] + pdf[:-1]) / 2.
      return dmu * bin_meaf integral_element(mu, pdf):
      '''
      Returns an array of elements of the integrand dP = p(mu) dmu
      for a density p(mu) defined at sample values mu ; samples need
      not be equally spaced.  Uses a simple trapezium rule.
      Number of dP elements is 1 - (number of mu samples).
      '''
      dmu = mu[1:] - mu[:-1]
      bin_mean = (pdf[1:] + pdf[:-1]) / 2.
      return dmu * bin_mean
docs: Returns an array of elements of the integrand dP = p(mu) dmu
      for a density p(mu) defined at sample values mu ; samples need
      not be equally spaced.  Uses a simple trapezium rule.
      Number of dP elements is 1 - (number of mu samples).