Solution (source code)

= Solution

The scaling of the equation suggests $q=t^{-1/3}v(z)$, $z=xt^{-1/3}$, for $t>0$. Substitution gives
$$
v^{(3)}+6v^2v'-\frac13(v+zv')=0.
$$
Integrating in $z$ gives the scaled <Painlevé II equation>
$$
\boxed{v''=\frac z3v-2v^3+C,\qquad q(x,t)=t^{-1/3}v(xt^{-1/3}),}
$$
where $C$ is an arbitrary integration constant. If the standard normalization $w''=2w^3+sw+\alpha$ is desired, set $z=3^{1/3}s$ and $v(z)=i3^{-1/3}w(s)$. Then $\alpha=-3iC$ and
$$
q(x,t)=i(3t)^{-1/3}w\big(x/(3t)^{1/3}\big).
$$
The direct scaled equation avoids introducing imaginary variables when a real $v$ is required.