# Why can't I evaluate this integral and obtain a closed-form solution?

I have the following spherical density distribution:

$$\rho(x, z) = \frac{1}{\sqrt{x^2 + z^2}\left(1+\sqrt{x^2+z^2}\right)^2}$$

which I have broken into a "line of sight" dimension $$z$$ and a "transverse" dimension $$x$$. Integrating this profile along the line of sight gives the projected 2d density $$\Sigma$$:

$$\Sigma(x) = 2\int_0^\infty\rho(x,z)dz$$

I wish to compute this for any generic upper bound $$\zeta$$, i.e.

$$\Sigma(x; \zeta) = 2\int_0^\zeta\rho(x,z)dz$$

(that is, $$\zeta=\infty$$ corresponds to the case of projecting the entire distribution to the transverse plane, while $$\zeta<\infty$$ corresponds to a projection which is truncated in the $$z$$-dimension).

It turns out this has to be solved piecewise; the solution for $$x>1$$, via Mathematica 11.3, is

$$\left.\int_0^\zeta\rho(x, z)dz\right\rvert_{x>1} = \frac{\zeta \left(\sqrt{x^2+\zeta^2}-1\right)}{\left(x^2-1\right) \left(x^2+\zeta^2-1\right)}+\frac{\tan ^{-1}\left(\frac{\zeta}{\sqrt{\left(x^2-1\right) \left(x^2+\zeta^2\right)}}\right)-\tan ^{-1}\left(\frac{\zeta}{\sqrt{x^2-1}}\right)}{\left(x^2-1\right)^{3/2}}$$

However, I am unable to obtain the solution for the case $$x<1$$. I currently only have access to Mathematica 12.0, rather than 11.3, and it is failing on this integral for both cases, even the one above. Performing

Assuming[{x < 1, ζ ∈ Reals, ζ > 0},
FullSimplify[Integrate[1/(Sqrt[x^2 + z^2] (1 + Sqrt[x^2 + z^2])^2), {z, 0, ζ}]]]


returns a HyperGeometric function, though I suspect that the $$x<1$$ case should not be much more complicated than $$x>1$$. Can anyone confirm? Or see any issue?

• Just do indefinite integration very fast. With version 8.0 you don't need any assumptions to get mint[x_, z_] = Integrate[1/(Sqrt[x^2 + z^2] (1 + Sqrt[x^2 + z^2])^2), z]  the result (Sqrt[-1 + x^2] z (-1 + Sqrt[x^2 + z^2]) - (-1 + x^2 + z^2) ArcTan[z/ Sqrt[-1 + x^2]] + (-1 + x^2 + z^2) ArcTan[z/( Sqrt[-1 + x^2] Sqrt[x^2 + z^2])])/((-1 + x^2)^( 3/2) (-1 + x^2 + z^2))  . Since mint[x,0]==0, your definte integral is mint[x, \[Zeta]]  .(only not defined at x==0) – Akku14 Oct 16 '20 at 16:36
• (only not defined at x==0 AND z==1 – Akku14 Oct 16 '20 at 16:44

Beside @user64494 answer, which is valid for 0<x<1 && 0<ζ < Sqrt[1 - x^2], there is another solution (Mathematica v12) valid for 0<x<1 && ζ >= Sqrt[1 - x^2]:

Integrate[1/(Sqrt[x^2 + z^2] (1 + Sqrt[x^2 + z^2])^2), {z, 0, ζ},
Assumptions -> x < 1 && x >= 0 && ζ >= Sqrt[1 - x^2]]
(*ConditionalExpression[(ζ (-1 + Sqrt[x^2 + ζ^2]))/((-1 + x^2)
(-1 + x^2 + ζ^2)) + (I ArcTanh[ζ/Sqrt[1 - x^2]])/(-1 +x^2)^(3/2)-
(I ArcTanh[ζ/Sqrt[-(-1 + x^2) (x^2 + ζ^2)]])/(-1 + x^2)^(3/2),x>0]*)

• The option Assumptions -> x < 1 && x >= 0 && \[Zeta] >= Sqrt[1 - x^2] exhausts all the possibilities. – user64494 Sep 16 '20 at 7:22
• @user64494 No you need both conditions mentioned in my answer to describe the case 0<x<1 – Ulrich Neumann Sep 16 '20 at 7:26
• Ulrich Neumann (@ does not work): The condition \[Zeta] >= Sqrt[1 - x^2] is more general than your \[Zeta] > Sqrt[1 - x^2] . Hope I am clear now. – user64494 Sep 16 '20 at 7:41
• @user64494 (@ works if you remove the blancs "@UlrichNeumann") You're right, but Mathematica doesn't evaluate the case \[Zeta] = Sqrt[1 - x^2] – Ulrich Neumann Sep 16 '20 at 7:52
• My "reality" might be found in help " Spaces are not valid in comment reply names, so don't use "@peter smith", always enter it as @peters or @petersmith" – Ulrich Neumann Sep 16 '20 at 8:49

The following works in 12.0:

Integrate[1/(Sqrt[x^2 + z^2] (1 + Sqrt[x^2 + z^2])^2), {z, 0, ζ},
Assumptions -> x < 1 && x >= 0 && ζ > 0]
(*ConditionalExpression[(ζ (-1 + Sqrt[x^2 + ζ^2]))/((-1 +
x^2) (-1 + x^2 + ζ^2)) -  ArcTan[ζ/Sqrt[-1 + x^2]]/(-1 + x^2)^(3/2) +
ArcTan[ζ/Sqrt[(-1 + x^2) (x^2 + ζ^2)]]/(-1 + x^2)^(3/2),
ζ < 1 && 0 < x < Sqrt[1 - ζ^2]]*)

• Hmm, did this take a while to run, or? Mine runs for a few minutes before spitting the Integrate call back to me. – Anonymous Sep 16 '20 at 14:07
• @Anonymous: It takes 36.3935 s on my old comp. – user64494 Sep 16 '20 at 14:24
• Hang on, this answer turns out to be identical to the x>1 case... indeed, this returns an imaginary answer for x<1 (the denominator at the end of the final term isn't real) – Anonymous Sep 16 '20 at 14:37
• @Anonymous: You are not right, e.g. ConditionalExpression[(\[Zeta] (-1 + Sqrt[x^2 + \[Zeta]^2]))/((-1 + x^2) (-1 + x^2 + \[Zeta]^2)) - ArcTan[\[Zeta]/Sqrt[-1 + x^2]]/(-1 + x^2)^(3/2) + ArcTan[\[Zeta]/ Sqrt[(-1 + x^2) (x^2 + \[Zeta]^2)]]/(-1 + x^2)^(3/2), \[Zeta] < 1 && 0 < x < Sqrt[1 - \[Zeta]^2]] /. {x -> 1/2, \[Zeta] -> 0.1} performs 0.0879209 + 0. I. Don't hesitate to ask for further explanation in need. – user64494 Sep 16 '20 at 15:17
• So-called @Anonymous: the pleasure is all mine. – user64494 Sep 17 '20 at 4:09