Take a unit box, the energy eigenfunctions are $\sin(n\pi x)$ (ignoring normalization constant) inside the box and 0 outside. I have read that there is no momentum operator for a particle in a box, since $\frac{\hbar}{i}\frac{d}{dx}\sin(n\pi x)=\frac{\hbar}{i}n\pi\cos(n\pi x)$ and this isn't 0 at the end points. Nonetheless, we can write $\sin(n\pi x)=\frac{e^{in\pi x}-e^{-in\pi x}}{2i}$, which seems to imply that there are two possible values of momentum: $n\pi$ and $-n\pi$, each with 50% probability.. Is this wrong? If you measured one of these momenta and the wavefunction collapsed to one of the eigenstates then it wouldn't solve the boundary conditions. So, what values of momentum could you obtain if you measured the momentum of a particle in a box?
Edit: I know that you can't measure the momentum of a particle exactly, but normally after a measurement of momentum, or such a continuous observable, the wavefunction collapses to a continuous superposition of momentum eigenstates corresponding to the precision of your measurement. But in this case since the wavefunction seems to just be a superposition of two momentum eigenstates, the wavefunction must have to collapse to one of them exactly, or so it seems.