Solution (source code)

= Solution

For a spherical hydrostatic star with negligible surface <pressure>, the <stellar virial theorem> is
$$
\Omega+3\int P\,dV=0.
$$
For a monatomic nonrelativistic <perfect gas>, $U=\tfrac32\int P\,dV$, so $2U+\Omega=0$ and the total energy is $E=U+\Omega=\Omega/2$. Half the released binding energy raises the <internal energy>; only the other half can be radiated. With fixed mass, no nuclear supply and no external work, <conservation of energy> gives
$$
L=-\frac{dE}{dt}=-\frac12\frac{d\Omega}{dt}.
$$
For the <uniform-density stellar model>, this becomes the contraction-luminosity evolution equation
$$
\boxed{L(t)=-\frac{3GM^2}{10R^2}\frac{dR}{dt},\qquad\frac{d}{dt}\left(\frac1R\right)=\frac{10L(t)}{3GM^2}.}
$$
It relates <luminosity> to the contraction rate; it does not by itself prescribe $L(t)$. Given $L(t)$,
$$
\frac1{R(t)}=\frac1{R_0}+\frac{10}{3GM^2}\int_0^tL(t')\,dt'.
$$
For constant <luminosity>, $R(t)=R_0/[1+t/t_0]$ with $t_0=3GM^2/(10R_0L)$. This describes quasi-static <Kelvin-Helmholtz contraction>, not dynamical free fall. If the gas has a different constant <specific-heat ratio> $\gamma_g$, the appropriate <stellar virial theorem> is $3(\gamma_g-1)U+\Omega=0$, so the radiated fraction of binding release is $(3\gamma_g-4)/[3(\gamma_g-1)]$ rather than universally one half.