Solution (source code)

= Solution

Write $P=p_\infty/\rho>0$. Multiplying the radius <ordinary differential equation> by $2R^2\dot R$ gives an exact derivative:
$$
\frac d{dt}(R^3\dot R^2)
=2R^2\dot R\left(R\ddot R+\frac32\dot R^2\right)
=-2PR^2\dot R=-\frac{2P}{3}\frac d{dt}(R^3).
$$
The <initial conditions> therefore give the <first integral>
$$
R^3\dot R^2=\frac{2P}{3}(a^3-R^3),\qquad
\boxed{\dot R=-\sqrt{\frac{2p_\infty}{3\rho}
\left(\frac{a^3}{R^3}-1\right)}}.
$$
Choose the negative square root because the cavity starts accelerating inward. It cannot turn around while $0<R<a$, since the squared speed is then strictly positive. Separating variables, with $s=R/a$, proves the <collapse time of a spherical cavity> is
$$
t_{\rm collapse}
=\sqrt{\frac{3\rho}{2p_\infty}}
\int_0^a\frac{R^{3/2}}{\sqrt{a^3-R^3}}\,dR
=a\sqrt{\frac\rho{p_\infty}}
\sqrt{\frac32}\int_0^1\frac{s^{3/2}}{\sqrt{1-s^3}}\,ds.
$$
Hence
$$
\boxed{t_{\rm collapse}=k\sqrt{\frac{\rho a^2}{p_\infty}},\qquad
k=\sqrt{\frac32}\int_0^1\frac{s^{3/2}}{\sqrt{1-s^3}}\,ds}.
$$
The <improper integral> is finite: its integrand behaves as $s^{3/2}$ near zero and as $[3(1-s)]^{-1/2}$ near one. The divergent inward speed as $R\to0$ signals a singular endpoint of this ideal <incompressible flow> model; the finite collapse time follows within that model.