Solution (source code)

= Solution

<Hydrostatic equilibrium> requires
$$
\boxed{\frac{dp}{dr}=-\rho\frac{d\Phi}{dr}=-\rho\Omega^2r}.
$$
For the <polytrope> $p=K\rho^{1+1/n}$, the specific enthalpy is
$$
h(\rho)=\int\frac{dp}{\rho}=(n+1)K\rho^{1/n}.
$$
Thus $h+\Phi$ is constant. Since $\rho=p=0$ at $r=R$, this constant is $\Omega^2R^2/2$, and
$$
\boxed{\rho(r)=
\left[\frac{\Omega^2(R^2-r^2)}{2(n+1)K}\right]^n},
$$
$$
\boxed{p(r)=K
\left[\frac{\Omega^2(R^2-r^2)}{2(n+1)K}\right]^{n+1}}
$$
for $0\leq r\leq R$, with both fields zero outside the model star.