Solution (source code)

= Solution

Twice differentiating gives $d^2\sin(kx)/dx^2=-k^2\sin(kx)$, so inside the <infinite square well>
$$
\hat H\sin(kx)=\frac{\hbar^2k^2}{2m}\sin(kx).
$$
The <boundary condition> at zero is automatic. The other requires $\sin(kL)=0$, hence $kL=n\pi$. A nonzero <eigenfunction> can therefore be labelled by
$$
\boxed{k_n=\frac{n\pi}{L},\qquad E_n=\frac{n^2\pi^2\hbar^2}{2mL^2},\qquad n=1,2,3,\ldots.}
$$
If desired, its normalized form is $\sqrt{2/L}\sin(n\pi x/L)$. The positive lowest <energy> follows from confinement and the required spatial variation of a nonzero <wavefunction>.