3
$\begingroup$

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?

$\endgroup$
2
  • $\begingroup$ 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) $\endgroup$
    – Akku14
    Oct 16, 2020 at 16:36
  • $\begingroup$ (only not defined at x==0 AND z==1 $\endgroup$
    – Akku14
    Oct 16, 2020 at 16:44

2 Answers 2

2
$\begingroup$

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]*)
$\endgroup$
8
  • $\begingroup$ The option Assumptions -> x < 1 && x >= 0 && \[Zeta] >= Sqrt[1 - x^2] exhausts all the possibilities. $\endgroup$
    – user64494
    Sep 16, 2020 at 7:22
  • $\begingroup$ @user64494 No you need both conditions mentioned in my answer to describe the case 0<x<1 $\endgroup$ Sep 16, 2020 at 7:26
  • $\begingroup$ 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. $\endgroup$
    – user64494
    Sep 16, 2020 at 7:41
  • $\begingroup$ @user64494 (@ works if you remove the blancs "@UlrichNeumann") You're right, but Mathematica doesn't evaluate the case \[Zeta] = Sqrt[1 - x^2] $\endgroup$ Sep 16, 2020 at 7:52
  • 2
    $\begingroup$ 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" $\endgroup$ Sep 16, 2020 at 8:49
1
$\begingroup$

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]]*)
$\endgroup$
8
  • $\begingroup$ Hmm, did this take a while to run, or? Mine runs for a few minutes before spitting the Integrate call back to me. $\endgroup$ Sep 16, 2020 at 14:07
  • $\begingroup$ @Anonymous: It takes 36.3935 s on my old comp. $\endgroup$
    – user64494
    Sep 16, 2020 at 14:24
  • $\begingroup$ 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) $\endgroup$ Sep 16, 2020 at 14:37
  • $\begingroup$ @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. $\endgroup$
    – user64494
    Sep 16, 2020 at 15:17
  • 1
    $\begingroup$ So-called @Anonymous: the pleasure is all mine. $\endgroup$
    – user64494
    Sep 17, 2020 at 4:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.