Solution (source code)

= Solution

The first two <probability densities> are
$$
\boxed{\rho_1(x)=\frac2L\sin^2\frac{\pi x}L,\qquad \rho_2(x)=\frac2L\sin^2\frac{2\pi x}L.}
$$
Both vanish at the walls. The <ground state> has one maximum at $L/2$ and no interior node. The first excited state has a node at $L/2$ and equal maxima at $L/4$ and $3L/4$.

For a <finite square well> whose exterior potential is $V_0>E_n$, the exterior <wavefunction> decays as $e^{-\kappa d}$, where $\kappa=\sqrt{2m(V_0-E_n)}/\hbar$ and $d$ is distance from the relevant edge. <Wavefunction matching at a finite potential step> makes the <wavefunction> and, for constant <mass>, its first derivative continuous. Thus the <probability density> is nonzero at the edges and has evanescent tails outside, the interior wavelength increases, and the <energy levels> are lower than for infinite walls at the same positions. Reflection symmetry still gives an even <ground state> and odd first excited state about the center, when both are bound. A shallow well may not support that excited bound state at all.

\Image[/past-exam-of-the-physics-a-course-of-the-university-of-cambridge/2019/paper-1-box-states.png]
{title=Lowest box-state densities and their evanescent tails for one finite-depth example}