# 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?

The following works in 12.0:

Integrate[1/(Sqrt[x^2 + z^2] (1 + Sqrt[x^2 + z^2])^2), {z, 0, \[Zeta]},
Assumptions -> x < 1 && x >= 0 && \[Zeta] > 0]
(*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]]*)

• 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 at 14:07
• @Anonymous: It takes 36.3935 s on my old comp. – user64494 Sep 16 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 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 at 15:17
• So-called @Anonymous: the pleasure is all mine. – user64494 Sep 17 at 4:09

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

Integrate[1/(Sqrt[x^2 + z^2] (1 + Sqrt[x^2 + z^2])^2), {z, 0, \[Zeta]},
Assumptions -> x < 1 && x >= 0 && \[Zeta] >= Sqrt[1 - x^2]]
(*ConditionalExpression[(\[Zeta] (-1 + Sqrt[x^2 + \[Zeta]^2]))/((-1 + x^2)
(-1 + x^2 + \[Zeta]^2)) + (I ArcTanh[\[Zeta]/Sqrt[1 - x^2]])/(-1 +x^2)^(3/2)-
(I ArcTanh[\[Zeta]/Sqrt[-(-1 + x^2) (x^2 + \[Zeta]^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 at 7:22
• @user64494 No you need both conditions mentioned in my answer to describe the case 0<x<1 – Ulrich Neumann Sep 16 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 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 at 7:52
• Ulrich Neumann: Don't understand you. the command Integrate[ 1/(Sqrt[x^2 + z^2] (1 + Sqrt[x^2 + z^2])^2), {z, 0, \[Zeta]}, Assumptions -> x < 1 && x >= 0 && \[Zeta] >= Sqrt[1 - x^2]] performs ConditionalExpression[(\[Zeta] (-1 + Sqrt[x^2 + \[Zeta]^2]))/((-1 + x^2) (-1 + x^2 + \[Zeta]^2)) + ( I ArcTanh[\[Zeta]/Sqrt[1 - x^2]])/(-1 + x^2)^(3/2) - ( I ArcTanh[\[Zeta]/Sqrt[-(-1 + x^2) (x^2 + \[Zeta]^2)]])/(-1 + x^2)^( 3/2), x > 0].Your words "@ works if you remove the blancs @UlrichNeumann" do not correspond to reality. – user64494 Sep 16 at 8:06