I found a strange behavior in Mathematica when trying to evaluate the integral
$$f(n) = \int_{1}^2 \frac{\Gamma(n)\Gamma(x)}{\Gamma(x+n)}{\rm d}x$$
I evaluate this using F[n_] := NIntegrate[(Gamma[x] Gamma[n])/Gamma[x + n], {x, 1, 2}]
For large values of $n$ the two terms $\Gamma(n)$ and $\Gamma(x+n)$ will be huge, but the integrand itself is monotonely decreasing and contained in $[0,\frac{1}{n}]$.
Mathematica (10.3.1.0) is able to evaluate this integral for all values $n\in[1,1000]$ however for $n=171$ the integration breaks down with NIntegrate::izero
and gives $0$ as the result:
F[170] -> 0.00103244
F[171] -> 0.0 (NIntegrate::izero)
F[172] -> 0.00105424
If I try non-integer $n$ then I find that it breaks down for all $n \in [170.6,171.6]$ Increasing MinRecursion
or AccuracyGoal
does not help. The strange part is that Mathematica is able to evaluate the function perfectly well for $x\in[1,2]$ and the plot of the function over this interval looks just like it should. The plot below is $n\cdot\frac{\Gamma(n)\Gamma(x)}{\Gamma(x+n)}$ for $n=171$:
$~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~$
My questions are as follows:
- What is going on here?
- Is there any settings that I can turn on to fix this?
Beta[]
is built-in... $\endgroup$LogGamma[]
and exponentiate at the very end, or figure out an alternative expression using any ofPochhammer[]
,Binomial[]
,FactorialPower[]
,Beta[]
... $\endgroup$