Solution (source code)

= Solution

Assume a Newtonian, spherically symmetric, nonrotating body in <hydrostatic equilibrium>, supported by a <polytropic equation of state> $P=K\rho^{1+1/n}$ with constant $K>0$ and $n>0$. The <enclosed mass> and <hydrostatic pressure support equation> are
$$
\frac{dm}{dr}=4\pi r^2\rho,\qquad
\frac{dP}{dr}=-\frac{Gm\rho}{r^2}.
$$
Eliminate $m$ by first writing $r^2\rho^{-1}dP/dr=-Gm$ and then differentiating:
$$
\frac1{r^2}\frac{d}{dr}\left(\frac{r^2}{\rho}\frac{dP}{dr}\right)
=-4\pi G\rho.
$$
Let $\rho_c$ be central <mass density>, and introduce the <Lane-Emden variables for a stellar polytrope>
$$
\rho=\rho_c\theta^n,\qquad
P=K\rho_c^{1+1/n}\theta^{n+1},\qquad
r=a\xi,
$$
where
$$
a^2=\frac{(n+1)K}{4\pi G}\rho_c^{1/n-1}.
$$
Then $(1/\rho)dP/dr=(n+1)K\rho_c^{1/n}d\theta/dr$. Substitution cancels the dimensional factors and yields the <Lane-Emden equation>
$$
\boxed{\frac1{\xi^2}\frac{d}{d\xi}\left(\xi^2\frac{d\theta}{d\xi}\right)
=-\theta^n,\qquad \theta(0)=1,\quad\theta'(0)=0.}
$$
The central conditions enforce the chosen central <mass density> and regular <spherical symmetry>. The local regular expansion is $\theta=1-\xi^2/6+n\xi^4/120+\cdots$. If a finite first zero $\xi_1$ exists and surface <pressure> is negligible, the physical <radius> is $R=a\xi_1$, and the <Lane-Emden mass formula> is $M=4\pi a^3\rho_c[-\xi_1^2\theta'(\xi_1)]$. For $0<n<5$ the standard isolated solution has a finite surface; $n=5$ has infinite extent, so a finite surface must not be assumed for all indices. Irradiation, composition stratification and non-polytropic equations of state require more general structure equations.