Suppose if we know wavefunction $\psi(x,0)$ at an initial time $t=0$ and want to find wavefunction at later time t ; for solving such problem first we find $\phi(p,0)$ that is initial wave function in momentum space,which we find by using inverse fourier transform and then we use fourier transform to get time dependent wave function $\psi(x, t)$ but while doing so we are integrating over all values of $p$ (momentum). This method seems to me alright for the case of free particle but for any other case like particle in a box,where momentum is discrete then Is it right to use fourier transform method to find wave function at a later time $t$? I have a question based on above problem: If at $t=0$, wavefunction is constant for particle in a box in region $-a<x<a$ then find the complete wavefunction at a later time $t$.
I have solved above problem but not by using fourier transform (I will attach a link of the photo of its solution) but if I use fourier transform then I get a differnt result! So my question is which method is more appropriate to use and when to use which method? https://i.stack.imgur.com/lwPhg.jpg