I guess this is a straightforward question but I was wondering if I can get an explicit steps toward the answer.
Using the Gross-Pitaevskii equation: $$ \tag{1} i \hbar\frac{\partial\psi\left(x,t\right)}{\partial t} =\left(-\frac{\hbar^{2}}{2m} \nabla^{2} + V_{ext} + g \left|\psi\left(x,t\right)\right|^{2} \right) \psi\left(x,t\right)$$ With the variational relation: $$\tag{2} i \hbar\frac{\partial\psi}{\partial t} = \frac{\delta\epsilon}{\delta \psi^{*}}$$ We can find the energy density by equating the right hand side of equation (1) and equation (2).
$$ \tag{3} \frac{\delta\epsilon}{\delta \psi^{*}} = \left(-\frac{\hbar^{2}}{2m} \nabla^{2} + V_{ext} + g \left|\psi\left(x,t\right)\right|^{2} \right) \psi\left(x,t\right)$$
By integrating both sides of equation (3) over $\psi^{*}$ we get:
$$ \tag{4} \epsilon \left[\psi \right] = \left(\frac{\hbar^{2}}{2m} \left|\nabla \psi\right|^{2} + V_{ext} \left|\psi\right|^{2} + \frac{g}{2} \left|\psi\right|^{4} \right)$$
My question is:
What are the explicit steps to get equation (4) from equation (3) ?
In my calculations I have a problem only in getting the factor $\frac{g}{2}$ in the last term in equation (4) and also getting $\epsilon[\psi]$ from $\frac{\delta\epsilon}{\delta \psi^{*}}$.
Thank you!