code: def betaprime_pdf(x, a, b):
      if x > 0:
          logf = (
              (a - 1) * math.log(x)
              - (a + b) * math.log1p(x)
              - sc.betaln(a, b)
          )
          return math.exp(logf)
      else:
          # return pdf at x == 0 separately to avoid runtime warnings
          if a > 1:
              return 0
          elif a < 1:
              return np.inf
          else:
              return 1 / sc.beta(a, b)
  
imports: import math
  import numbers
  import numpy
  from scipy import stats
  from scipy import special
  from ._qmc import check_random_state, Halton, QMCEngine
  from ._unuran.unuran_wrapper import NumericalInversePolynomial
  from scipy._lib._util import check_random_state
label_desc: Use image node_id 4 for calling a global function with example usage: betaprime_pdf(x, a, b) and returns: math, int, np, unknown