# Composite Gamma function simplification

I'm running some python code using the gamma function and it involves dividing one gamma function with another. Unfortunately because both the numerator and denominator are so large, python outputs a maths range error, even though the fraction is equivalent to a small finite number. Therefore it needs to be simplified.

Here is the function I therefore need to simply ( attached as a picture):

• Can $k$ be a lot bigger than $m$ or is $k-m$ bounded? – robjohn Mar 1 '15 at 7:59

It holds: $\Gamma(m + \beta + 1) \Gamma(k + \alpha + 1) = B(m + \beta + 1, k + \alpha + 1) \Gamma(m+k+ \beta + \alpha + 2)$.
What I should do is : take the logarithms and for each logarithm of any gamma function, use Stirling series (http://en.wikipedia.org/wiki/Stirling%27s_approximation) $$\log(n!)=n\log(\frac ne) + \frac 12 \log(2\pi n)+\log(1+\frac{1}{12 n}+\frac{1}{288 n^2}-\frac{139}{51840 n^3}+\cdots)$$ When all terms will have been added, exponentiate the result.