# Why can't Mathematica integrate this integral?

I'm trying to estimate this integrate:

Here Θ is the Heaviside theta function. And I can use

PR[k_] := 2.1*10^-9 (k/0.05)^.04


I want to solve this integral for a set of "k" from 0.05 to 10^20.

For beginning I tried to solve this just for "k==10^5" But after 2 hours running nothing happened.

I used this simple command:

1/12 Integrate[((4 v^2 - (1 + v^2 - u^2)^2)/(4 v u))^2 (3/(
4 u^3 v^3))^2 (u^2 + v^2 -
3)^2 ((-4 u v + (u^2 + v^2 - 3) Log[(3 - (u + v)^2)/(
3 - (u - v)^2)])^2 + \[Pi]^2 (u^2 + v^2 -
3)^2 HeavisideTheta[v + u - Sqrt[3]]) PR[k u] PR[k v], {u, Abs[1 - v], Abs[1 + v]}, {v, 0, Infinity}]


Is this happen because of my weak system or I have some mistakes?

• Are you looking for an analytical answer? Have you tried NIntegrate instead? – MarcoB May 27 '20 at 13:01
• And if you're looking for a closed-form analytical answer, do you have reason to believe that one exists? – Michael Seifert May 27 '20 at 13:05
• @MarcoB NInegrate does not support Abs[x] in the limit of integrations. For example NIntegrate[Sin[x], {x, Abs[1 - x], Abs[1 + x]}] gives error. I never seen integral with such limits myself before. – Nasser May 27 '20 at 13:06
• You are going to have hard time getting this to integrate. Even the indefinite integral seems to hang. And when using Integrate it is not a good idea to use non-exact numbers.  2.1*10^-9 (k/0.05)^.04 you can change these to exact numbers. – Nasser May 27 '20 at 13:08
• @Nasser It would support such limits of integration with Abs if they become numerical: see e.g. NIntegrate[Sin[x y], {x, -10, 10}, {y, Abs[1 - x], Abs[1 + x]}], which works fine. Your example does not work because the limits of integration are non-numerical, not because they contain Abs. – MarcoB May 27 '20 at 13:13

As I noted in the comments, it seems unlikely that an analytic closed-form solution to this integral exists. However, if all you need is a numerical integral, then you can use the Region method to specify the region of integration.

PR[k_] := 2.1*10^-9 (k/0.05)^.04
k = 10^5;
1/12 NIntegrate[((4 v^2 - (1 + v^2 - u^2)^2)/(4 v u))^2 (3/( 4 u^3 v^3))^2 (u^2 + v^2 - 3)^2 ((-4 u v + (u^2 + v^2 - 3) Log[(3 - (u + v)^2)/(3 - (u - v)^2)])^2 + \[Pi]^2 (u^2 + v^2 - 3)^2 HeavisideTheta[v + u - Sqrt[3]]) PR[k u] PR[k v],
{u, v} \[Element] ImplicitRegion[Abs[1 - v] < u < Abs[1 + v], {u, v}]]


The method of specifying ranges of integration for u and v does not work in this case because the bounds with respect to u depend on the value of v, and NIntegrate does not allow the bounds of integration to depend on other variables when specified in this form. The use of ImplicitRegion gets around this restriction.

Alternately, if one defines $$x = u + v$$ and $$y = u - v$$, then the region of integration becomes $$x \geq 1$$ and $$-1\leq y \leq 1$$. Under the appropriate substitutions in the integrand, one could easily integrate this over the range {x, 1, Infinity} and {y, -1, 1}. Note that you will have to insert a Jacobian into the integral to account for the different volume element in these coordinates (I believe it works out to be 1/2 in this case.)

This said, I suspect that your integral may have an error. Specifically, the logarithm function looks strange; there are points in your range of integration for which its argument is positive, but also points for which its argument is negative. This yields a complex result in the end, and Mathematica is not confident in its results due to the resulting divergence of the integrand. Perhaps you need an absolute value on the argument?

• Dear @MichaelSeifert, I don't want an analytical answer but as you said NIntegrate isn't suitable for this problem. I tried to use your answer but the problem still exist. – milad May 27 '20 at 15:39
• @milad: Sorry, I made a slight error. I meant my code to use NIntegrate rather than Integrate. I've edited it appropriately; you might want to try it again. – Michael Seifert May 27 '20 at 17:29
• I noticed the typo and use NIntegrate. I let to code run for 30min but as I said the problem still exist. Also I'm not sure about changing integration sequence in this special inregral. did you run this command? – milad May 27 '20 at 17:36
• Running the code as I've posted it above on a fresh kernel leads to a result on my machine within about 5 seconds. What version of Mathematica are you using? – Michael Seifert May 27 '20 at 17:41
• @milad: There's also a possible technique using change of variables, if you're not sure about the use of ImplicitRegion. See my edited answer. – Michael Seifert May 27 '20 at 18:26