I'm currently considering a rectangular window $\psi$ function: $$ \psi(x) = \begin{cases}\left(2a\right)^{-1/2}&\text{for } |x|<a \\ 0&\text{otherwise.} \end{cases} $$ I am interested in the momentum uncertainty of this function. I expect it to be a function of a, the 'width' of $\psi$ in the x-space.
I claim that $\langle{p}\rangle = 0$ because this is a stationary state and so $m\frac{d\langle x\rangle}{dt} = 0 $. This spares me a trial to take the derivative of a step function, which I'm about to have to do though for $\langle{p^2}\rangle$.
For $\langle{p^2}\rangle$ I should calculate:
$$ {-\hbar^2\int_{-a}^a\psi^*\frac{d^2}{dx^2}\psi} \,dx . $$
This requires taking the second derivative of a square window function, which I imagine will lead to infinite values. So instead, I will work in the momentum space after calculating the Fourier transform of $\psi$ for which I got the sinc function: $$ \phi(p) = \sqrt{\frac{\hbar}{a\pi}}\frac{\sin(\frac{a\pi p}{\hbar})}{p}. $$ And then I tried to calculate $\langle p^2 \rangle$ $$ \langle p^2\rangle = \frac{\hbar}{a\pi}\int_{-\infty}^{\infty}\frac{\sin^2(\frac{a\pi p}{\hbar})}{p^2}p^2dp = \frac{\hbar}{a\pi}\int_{-\infty}^{\infty}{\sin^2(\frac{a\pi p}{\hbar})} dp \rightarrow \infty $$
Am I mistaken? This would say that the uncertainty in momentum, $\sqrt{\langle p^2\rangle-\langle p\rangle^2}$ , is infinite independently of the width $a$ of the $x$-localization.