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):

Composite gamma functions that need to be simplified

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

HINT: Use the Beta function and ist symmetry in the two arguments.

It holds: $\Gamma(m + \beta + 1) \Gamma(k + \alpha + 1) = B(m + \beta + 1, k + \alpha + 1) \Gamma(m+k+ \beta + \alpha + 2)$.

In the denominator it holds a similar identity; use the symmetry of the Beta function to simplify.

  • $\begingroup$ I didn't know that Python had the Beta function. Learned something new. (+1) $\endgroup$ – robjohn Feb 28 '15 at 13:35

I do not know the kind of accuracy you expect. So, forgive me if I am off-topic.

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.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.