I am beginning to study quantum mechanics and I got stuck right at the beginning. I am trying to prove that the time derivative of the expected value of momentum of a particle is the (negative) expected value of the gradient of the potential, i.e., in one dimension we have \begin{equation} \frac{d\langle p\rangle}{dt}=-\left<\frac{dV}{dx}\right> \end{equation} which means \begin{equation} \frac{d\langle p\rangle}{dt}=-\int_{-\infty}^{\infty}\psi^*\frac{\partial V}{\partial x}\psi\ dx \end{equation} (here $\psi^*$ is the complex conjugate of $\psi$)
The wavefunction $\psi$ should be square summable, i.e. living in $L^2(\mathbb{R})$. I understand that we can quotient this space with the equivalence relation that associates two functions that are equal almost everywhere, so we can correctly state that $\psi(x,t)\longrightarrow 0$ when $x\longrightarrow\pm\infty$ and in this way we can get rid of the boundary terms when integrating by parts. But in the derivation of the above relation I got the following: \begin{equation} \frac{d\langle p\rangle}{dt}= \int_{-\infty}^\infty V\left(\psi^*\frac{\partial\psi}{\partial x}+\psi\frac{\partial\psi}{\partial x}^*\right)\ dx -\frac{\hbar^2}{2m}\left[\frac{\partial\psi}{\partial x}^*\frac{\partial\psi}{\partial x}\right]_{-\infty}^{\infty} \end{equation} Now, the boundary term should vanish for the relation to be verified, but why does it vanish? There are functions in $L^2$ whose derivatives are not in $L^2$, and that boundary term does not vanish in some of those cases. Should we be considering wave functions in some kind of Sobolev space instead? Is there a physical reason behind the vanishing of the boundary terms?