Solution (source code)

= Solution

For $P=K\rho^2$, <hydrostatic equilibrium> gives $2K\nabla\rho=-\nabla\Phi$. The <Poisson equation for Newtonian gravity> therefore gives the <Helmholtz equation>
$$
\nabla^2\rho+k^2\rho=0,\qquad k^2=\frac{2\pi G}{K}.
$$
For spherical symmetry, the regular <polytrope of index one> solution is
$$
\boxed{\rho(r)=\rho_c\frac{\sin(kr)}{kr}.}
$$
The singular $\cos(kr)/r$ solution is excluded by finite central <mass density>. Taking the first zero as the stellar surface yields
$$
\boxed{R=\frac\pi k=\sqrt{\frac{\pi K}{2G}}.}
$$
The mass integral is
$$
M=4\pi\int_0^R\rho r^2\,dr
=\frac{4\pi\rho_c}{k^3}\int_0^\pi u\sin u\,du
=\frac{4\pi^2\rho_c}{k^3}.
$$
Dividing by the volume $4\pi R^3/3$ gives
$$
\boxed{\frac{\bar\rho}{\rho_c}=\frac3{\pi^2}.}
$$