Solution (source code)

= Solution

Let $M(r)$ be the enclosed mass. For <spherical symmetry>, <hydrostatic equilibrium> and <mass conservation> give
$$
\frac{dp}{dr}=-\frac{GM(r)\rho(r)}{r^2},\qquad
\frac{dM}{dr}=4\pi r^2\rho.
$$
The isothermal <equation of state> $p=K\rho$ therefore implies
$$
K\frac{d\ln\rho}{dr}=-\frac{GM(r)}{r^2}.
$$
Multiply by $r^2$, differentiate and eliminate $M$:
$$
\boxed{\frac1{r^2}\frac d{dr}\left(r^2\frac{d\ln\rho}{dr}\right)
=-\frac{4\pi G}{K}\rho,}
$$
or equivalently $r^{-2}d[r^2\rho^{-1}\rho']/dr=-4\pi G\rho/K$. This is the density equation for an <isothermal sphere>. Here $K$ has units $\mathrm{m^2\,s^{-2}}$ and equals the squared <isothermal sound speed>.

A regular <isothermal sphere> does not reach zero density at a finite radius. The finite body discussed later must therefore be truncated by a nonzero external <pressure>, as in a <pressure-confined isothermal sphere>. A finite vacuum boundary would not be compatible with this <equation of state>.