Solution (source code)

= Solution

Treat $\psi$ and its <complex conjugate> as independent variables in the <functional derivative>. Integrating the gradient variation by parts, with vanishing boundary terms, gives
$$
\delta E=\int\left[-\frac{\hbar^2}{2m}\nabla^2\psi
+V_0|\psi|^2\psi+W_0|\psi|^4\psi\right]\delta\psi^*\,d\mathbf x
+\text{complex conjugate}.
$$
The factors follow from $\partial_{\psi^*}|\psi|^4=2|\psi|^2\psi$ and $\partial_{\psi^*}|\psi|^6=3|\psi|^4\psi$. Thus the <cubic-quintic Gross–Pitaevskii equation> is
$$
\boxed{i\hbar\partial_t\psi=-\frac{\hbar^2}{2m}\nabla^2\psi
+V_0|\psi|^2\psi+W_0|\psi|^4\psi}.
$$