I know that this question may sound silly but i'm truly confused, but if i had a wave function just like one who describes a potential well, let's call it $\Psi(x)$ and I want to calculate the uncertainity of a momentum for example, we know that:
\begin{equation} \Delta P=\sqrt{\langle p^{2}\rangle-\langle p\rangle^2} \end{equation} Since $\Psi$ is a continous wave function I understand that $$ \langle P\rangle=\int_{\mathfrak{R}}\left( \Psi^{\ast}i\hbar\cdot - \frac{\partial}{\partial x}\Psi \right)dx$$ But, what about $\langle p^2 \rangle $? from the basics on QM I know that: $$ \langle\psi|p^2|\psi\rangle=\langle \psi|p(p|\psi\rangle) $$ the question is, for a continous variable the relation for $$\langle p^2 \rangle=\hbar \int _{\mathfrak{R}}\Psi^{\ast} \frac{\partial^2}{\partial x^2} \Psi dx$$ or it is?: $$\langle p^2 \rangle=-i \hbar \int _{\mathfrak{R}}\Psi^{\ast} \frac{\partial^2}{\partial x^2} \Psi dx$$