use gamma function or inbuilt math.gamma() to compute vals of beta func

def beta(a, b):
  """use gamma function or inbuilt math.gamma() to compute vals of beta func"""
  beta = math.exp(math.lgamma(a) + math.lgamma(b) - math.lgamma(a + b))
  return beta