Energy of a Free Particle starting in an Infinite Square Well A particle is in the ground state of an infinite square well with walls in the range x=[0,a]. At time t=0, the walls are removed suddenly and the particle becomes free. What is the energy of the free particle?
What I know:
\begin{equation}
\begin{split}
V(x) &= 0, \; \; \;  0\le x \le L \\
&= \infty, \; \; \;otherwise
\end{split}
\end{equation}
\begin{equation}
\begin{split}
\psi(x,0)&=\sqrt{\frac{2}{a}} sin(\frac{\pi x}{a}) \\
E_1 &= \frac{\pi^2 \hbar^2}{2ma^2}
\end{split}
\end{equation}
I've found the wave function in momentum space $\phi(k)$ by taking the Fourier transform of the initial wavefunction.
\begin{equation}
\begin{split}
\phi(k) &= \frac{1}{2\pi\hbar} \int_{0}^{a} dx e^{ikx} \psi(x,0) \\
&=\frac{1}{a\pi\hbar} \frac{-\pi L (1+e^{-ikL)}}{k^2L^2 - \pi^2}
\end{split}
\end{equation}
I know $<E>=\frac{<p^2>}{2m}$, so I need to find
\begin{equation}
<p^2>= \int_{0}^{a} k^2 \mid \phi(k) \mid^2 dk
\end{equation}
Unfortunately, when I evaluate this integral, it diverges. Is there another way can I find energy of a free particle that yields an appropriate answer?
Note: I've also tried to evaluate the momentum space Schroedinger equation $i\hbar \frac{\partial \phi(p)}{\partial t} = H \phi(p)$. However, $\phi(p)$ is not time dependent from my evaluation, so the answer it yields is $0$.
 A: You have to solve the time dependent Schrödinger equation on the unlimited x-axis with the initial condition $$\psi(x, t=0)=\psi(x,0)=\sqrt{\frac{2}{a}} sin(\frac{\pi x}{a}) \tag 1$$ for 0≤x≤a and $$\psi(x,0)=0 \tag 1$$ for x≤0 and x≥a (in the ground state with L=a). For the initial value problem,  you first consider the time-dependent Schrödinger equation for t≥0 which has only a Hamiltonian with the kinetic energy term because the potential energy is zero: $$i\hbar \frac {\partial  \psi(x,t)}{\partial t}= -\frac{\hbar^2}{2m}\frac{\partial^2 \psi(x,t)}{\partial x^2} \tag2 $$ You assume a Fourier representation of the x-dependence of the solution $$\psi (x,t)=\frac {1}{\sqrt{2 \pi}} \int_{-\infty}^{+\infty} \hat\psi(k,t)\exp (ikx)dk \tag 3$$ giving you the linear first order ordinary differential equation in time $$i\hbar \frac {\partial \hat \psi(k,t)}{\partial t}=\frac{\hbar^2k^2}{2m}\hat \psi(k,t) \tag4 $$ which is the Schrödinger equation in momentum representation and has the solution $$\hat \psi(k,t)=\hat \psi(k,t=0)\exp(-i\frac{\hbar k^2}{2m}t) \tag 5$$ where $$\hat\psi(k,t=0)=\frac {1}{\sqrt{2 \pi}}\int_0^a \sqrt{\frac{2}{a}} sin(\frac{\pi x}{a})\exp(-ikx)dx=\frac {1}{\sqrt{a\pi}}\frac {\frac{\pi}{a}(\exp(-ika)+1)}{(\frac{\pi}{a})^2-k^2} \tag 6$$ is the Fourier transform of the  initial condition given by equations (1). 
As mentioned before, equation (5) is the time dependent solution of the Schrödinger equation in momentum representation (k-space). The expectation value for the energy is given by the scalar product $$<E>=\int_{-\infty}^{+\infty}\hat\psi^*(k,t)\frac{\hbar^2k^2}{2m}\hat\psi(k,t)dk=\int_{-\infty}^{+\infty}\hat\psi^*(k,0)\frac{\hbar^2k^2}{2m}\hat\psi(k,0)dk \tag7$$ It can be seen that there is no time dependence of the expectation value of the energy which stays the same as at $t=0$. An evaluation of the integral (7) is not necessary. Thus the expectation value of the energy stays constant at the expectation value at time $t=0$ which should be the same as the lowest energy eigenvalue of the Schrödinger equation for the infinite potential square well given in the question: $$E_1=\frac{\pi^2 \hbar^2}{2ma^2} \tag 8$$ 
