Inconsistency in Mathematica of whether integral diverges or not?

Consider the following (beta function) integral

Integrate[(1 - x)^a x^b, {x, 0, 1}]


ConditionalExpression[(Gamma[1 + a] Gamma[1 + b])/Gamma[2 + a + b], Re[b]>-1&&Re[a]>-1]

The above general case states that the integral only converges when Re[b]>-1 and Re[a]>-1. However, if we plug the following explicit constants into the integral, we get:

Integrate[(1 - x)^(-(1/2) - 2 I) x^(-2 + 7 I), {x, 0, 1}]


(Gamma[-1 + 7 I] Gamma[1/2 - 2 I])/Gamma[-(1/2) + 5 I]

In which case Mathematica seems to return a perfectly finite result that is the same as the general result above, except the parameters have been chosen such that the general case would not converge.

Now I am a bit confused and would like to ask:

Is the explicit result obtained above a bug in Mathematica and the integral actually should not converge at all? Or maybe the result and convergence is fine, and the constraints in the general case are wrong?

Which one is it?

Use:

Integrate[(1 - x)^(-(1/2) - 2 I) x^(-2 + 7 I), {x, m, 1}]


ConditionalExpression[(Gamma[-1 + 7 I] Gamma[1/2 - 2 I])/ Gamma[-(1/2) + 5 I] + (1/50 + (7 I)/50) m^(-1 + 7 I) Hypergeometric2F1[-1 + 7 I, 1/2 + 2 I, 7 I, m], 0 < Re[m] < 1 && Im[m] == 0]

and note that the first term is the result from your second integral, while the second, Hypergeometric2F1 term diverges for $$m \to 0$$ due to the factor $$m^{(-1+7i)}$$. So, the second example looks like a bug in Integrate.

Consider the Series expansion about the origin:

Series[(1 - x)^a x^b, {x, 0, 1}] //TeXForm


$$x^b \left(1-a x+O\left(x^2\right)\right)$$

So, the integral will only converge at the origin if $$\Re(b)>-1$$. Similarly, consider the Series expansion about $$x=1$$:

Series[(1 - x)^a x^b, {x, 1, 1}] //TeXForm


$$(1-x)^a \left(1+b (x-1)+O\left((x-1)^2\right)\right)$$

This integral will converge at $$x=1$$ only if $$\Re(a)>-1$$.

• To clarify: it's not the hypergeometric function that causes the divergence in the second term, it's the factor m^(-1 + 7 I). – J. M. will be back soon Sep 26 '18 at 21:58
• @J.M.issomewhatokay. Agreed, my original wording was confusing. – Carl Woll Sep 26 '18 at 22:10
• The result is certainly confusing, but is it absolutely wrong in all cases? With a suitable (non-standard) branch cut, I think you might be able to choose a spiral path (in the complex plane) to reach x=0 without the integrand diverging. – mikado Sep 26 '18 at 22:14
• Should I add the tag "bug" to the question? – Kagaratsch Sep 27 '18 at 12:12