Solution (source code)

= Solution

During ejection, the remaining <mass> is $m(t)=m_o+m_w-Qt$, and the water is exhausted at $t_c=m_w/Q$. Consider the <momentum> of the octopus and the small portion of water expelled during $dt$. Initially it is $mu$. At the end of this interval, the remaining body has <mass> $m-Q\,dt$ and <velocity> $u+du$, while the expelled <mass> $Q\,dt$ has laboratory <velocity> $u-V$, to first order. Hence the total final <momentum> is
$$
(m-Q\,dt)(u+du)+Q\,dt(u-V)=mu+m\,du-QV\,dt+o(dt).
$$
The external <impulse> from <quadratic drag> is $-\alpha u^2dt$. Equating this to the change in total <momentum>, and dividing by $dt$, proves the <equation of motion>
$$
\boxed{m\frac{du}{dt}=QV-\alpha u^2.}
$$
The outgoing water's <momentum> flux is essential: applying $d(mu)/dt$ to the remaining body alone would omit it.

For <dimensional analysis>, the independent physical inputs are $m_o,m_w,Q,V,\alpha$, with dimensions
$$
[m_o]=[m_w]=\mathsf M,\quad[Q]=\mathsf M\mathsf T^{-1},\quad[V]=\mathsf L\mathsf T^{-1},\quad[\alpha]=\mathsf M\mathsf L^{-1}.
$$
The scales $m_o$, $m_o/Q$ and $Vm_o/Q$ fix units of <mass>, time and length. In these units, the only remaining independent <dimensionless variables> are
$$
\boxed{\lambda=\frac{m_w}{m_o},\qquad\mu=\frac{\alpha V}{Q}.}
$$
For example, with $s=Qt/m_o$ and $w=u/V$, the <equation of motion> becomes $(1+\lambda-s)\,dw/ds=1-\mu w^2$, with $w(0)=0$ and ejection ending at $s=\lambda$. Thus the dimensionless terminal value depends only on $\lambda,\mu$, proving $u_c=Vf(\lambda,\mu)$.

For its explicit value, put $m_0=m_o+m_w$ and $U=\sqrt{QV/\alpha}$. The initially stationary solution stays below $U$, since the <acceleration> vanishes at $U$ and is positive below it. <Separation of variables> gives
$$
\int_0^{u(t)}\frac{dv}{QV-\alpha v^2}=\int_0^t\frac{d\tau}{m_0-Q\tau}.
$$
The two integrals yield
$$
\frac{1}{\sqrt{\alpha QV}}\operatorname{artanh}\frac{u(t)}U=\frac1Q\log\frac{m_0}{m_0-Qt}.
$$
This is <constant mass-loss propulsion with quadratic drag>. At $t_c$, the remaining <mass> is $m_o$, giving
$$
\boxed{u_c=\sqrt{\frac{QV}{\alpha}}\tanh\left(\sqrt{\frac{\alpha V}{Q}}\log\frac{m_o+m_w}{m_o}\right)
=\frac{V}{\sqrt\mu}\tanh\bigl(\sqrt\mu\log(1+\lambda)\bigr).}
$$
Thus $f(\lambda,\mu)=\mu^{-1/2}\tanh(\sqrt\mu\log(1+\lambda))$, verifying the required dimensional form. The limit as drag tends to zero is $V\log(1+\lambda)$, the ordinary <rocket equation>, while the positive-drag answer is below the <terminal velocity> $U$.