A well known exercise in basic quantum mechanics is the sudden (diabatic) increase of the length of an infinite square well.
Now consider a particle in an eigenstate of an infinite well that is suddenly decreased in length. At first glance, this seems troublesome since the eigenstate of the initial well cannot be expanded in the eigenstates of the smaller well.
So I thought about normalizing the initial eigenstate again inside the smaller well before calculating the overlap. This is what I got so far:
If the particle was initially in the ground state of an infinite well from $0$ tot $2a$, the renormalized wave function in a smaller well from $0$ to $a$ is \begin{equation} \phi_1 = \sqrt{\frac{2}{a}} \sin \frac{\pi x}{2a}. \end{equation} The eigenstates of the smaller well are \begin{equation} \psi_n = \sqrt{\frac{2}{a}} \sin \frac{n\pi x}{a}, \end{equation} and so the overlap is \begin{equation} c_n = \frac{2}{a} \int_0^a dx \sin \frac{\pi x}{2a} \sin \frac{n\pi x}{a} = (-1)^n \frac{8n}{\pi\left(1-4n^2\right)} \end{equation} Now the problem is that the expectation value of the energy diverges, \begin{equation} \left< E \right> = \sum_n \left|c_n\right|^2 E_n = \frac{32 \hbar^2}{ma^2} \sum_n \frac{n^4}{\left(1-4n^2\right)^2}. \end{equation}
This is because the wave function is discontinuous at $x=a$ so the first derivative contains a term proportional to $\delta(x-a)$.
So I concluded that this method is unsatisfactory since it yields non-physical results.
Is there a solution or is the problem ill defined? The adiabatic limit is certainly well defined.
EDIT
Following Kevin Zhou's proposal, I considered this system instead
For $E<V_0$, the solutions are given by \begin{align} \psi_1(x) & = \sin kx \\ \psi_2(x) & = \frac{\sin ka}{\sinh \lambda a} \sinh \lambda(2a-x), \end{align} with $k=\sqrt{2mE}/\hbar$ and $\lambda=\sqrt{2m(V_0-E)}/\hbar$. And the spectrum is found from \begin{equation} \lambda \tan ka = -k \tanh \lambda a, \end{equation} which has to be solved numerically. For $E>V_0$ we simply let $\lambda \rightarrow iq$ with $q=\sqrt{2m(E-V_0)}/\hbar$.