Uncertainty product at $t=0$ for a constant equation

Given the S.E $$\Psi(x,0) = \begin{cases} A,&0 \leq x \leq \frac{a}{2}, \\ 0,& \rm elsewhere \end{cases}$$ I'm supposed to find the uncertainty product at $t=0$. However since the equation is constant it doesn't seem to satisfy the uncertainty principle.

For the expectation value of $p$ and $p^{2}$ i get $$\langle p \rangle = - i \hbar |A|^{2}d \int_{0}^{\frac{a}{2}}\frac{d}{dx} dx = 0$$ and the same for $\langle p^{2} \rangle$ which result in the uncertainty $\Delta p = 0$. But this isn't allowed according to the uncertainty principle. Where is the catch?

• The wavefunction is not differentiable. Somewhat similar situation: physics.stackexchange.com/q/221027/2451 – Qmechanic Apr 5 '18 at 13:44
• What do you mean by S.E.? If you mean "Schrödinger Equation", then that's definitely not applicable to the wavefunction example you give at the start of your post. – Emilio Pisanty Apr 5 '18 at 13:57

Your wavefunction is not differentiable. If you want to calculate its momentum uncertainty, you need to look at your state in the momentum representation, \begin{align} \tilde\Psi(p) & = \frac{1}{\sqrt{2\pi\hbar}} \int_{-\infty}^{\infty} \Psi(x) e^{-ipx/\hbar} \mathrm dx \\ & = \frac{A}{\sqrt{2\pi\hbar}} \int_0^{a/2} e^{-ipx/\hbar} \mathrm dx %\\ & = \frac{A}{\sqrt{2\pi\hbar}} \frac{e^{-ipa/2\hbar}-1}{p/\hbar} %\\ & = \frac{A}{\sqrt{2\pi\hbar}} \frac{e^{-ipa/4\hbar}-e^{-ipa/4\hbar}}{p/\hbar}e^{-ipa/4\hbar} %\\ & = \frac{A}{\sqrt{2\pi\hbar}} \frac{-2i\sin(pa/4\hbar)}{p/\hbar}e^{-ipa/4\hbar} \\ & = \frac{Aa}{2i\sqrt{2\pi\hbar}} \frac{\sin(pa/4\hbar)}{pa/4\hbar}e^{-ipa/4\hbar} \\ & = \frac{Aa}{2i\sqrt{2\pi\hbar}} \mathrm{sinc}(pa/4\hbar)e^{-ipa/4\hbar}. \end{align} (Intermediate steps commented in this answer's source.) Your task is then to calculate the variance of the momentum directly in the momentum representation, $$\langle p^2\rangle = \int_{-\infty}^\infty |\tilde \Psi(p)|^2 p^2 \,\mathrm dp,$$ using the above wavefunction. You should be able to easily verify that the momentum variance is infinite, which corresponds to the fact that the position-representation wavefunction is neither continuous nor differentiable and it thus, strictly speaking, falls outside of the domain of the momentum operator.