I am trying to use Mathematica to check an integral from a book, and cannot get it done. The book talks about a spherically symmetric mass distribution in $R^3$ of the form
$\rho(r)=r^{-\gamma}, \gamma<3$
and it goes on by stating that the Newtonian potential to that distribution is given by
$\phi(r) = 4π\ln r + \mathrm{const.}, \gamma=2$
and
$\phi(r) = \frac{4π}{(2-\gamma)(3-\gamma)}r^{2-\gamma}+\mathrm{const.}, \gamma\neq2$ .
(There are a couple more constants in the book which I set to 1 here for simplicity.)
I wanted to verify this by directly evaluating the integral for the potential
$\phi(\mathbf x) = -\int_{R^3}\frac{\rho(\mathbf x')}{|\mathbf x-\mathbf x'|}\,d^3x' =-4π\int_0^\infty\frac{\rho(r')}{|r-r'|}r'^2\,dr'$ ,
and I am failing.
Here is my code to check the $\gamma=2$ case:
Assuming[{r > 0, g == 2}, -4 π Integrate[
s^(-g) / Abs[r - s] s^2, {s, 0, ∞}]]
Mathematica gives me the message: "Integrate: Integral of 1/Abs[r-s] does not converge on {0,[Infinity]}"
My code for the other case is
Assuming[{r > 0, g != 2, g < 3}, -4 π Integrate[
s^(-g) / Abs[r - s] s^2, {s, 0, ∞}]]
which also yields "Integrate: Integral of s^(2-g)/Abs[r-s] does not converge on {0, ∞}."
What am I missing?
FullSimplify[Integrate[s^(2-g)/Sqrt[(r-s)^2],s]]
does this help? You can now tryLimit
andSeries
withAssuming
. $\endgroup$