Solution (source code)

= Solution

The infinite exterior potential enforces $\psi=0$ outside $0<x<L$. Within the well,
$$
-\frac{\hbar^2}{2m}\psi''=E\psi,\qquad
\psi=A\sin kx+B\cos kx,\qquad k^2=\frac{2mE}{\hbar^2}.
$$
The <boundary conditions> give $B=0$ and $kL=n\pi$, with $n\ge1$. Since $\int_0^L\sin^2(n\pi x/L)\,dx=L/2$, normalization gives
$$
\boxed{E_n=\frac{n^2h^2}{8mL^2},\quad
\psi_n=\sqrt{\frac2L}\sin\frac{n\pi x}{L},\quad
\rho_n=\frac2L\sin^2\frac{n\pi x}{L}}.
$$
These functions vanish outside the well. The ground state $n=1$ has energy $E_1$ and one density maximum at $L/2$. The first excited state $n=2$ has energy $4E_1$, a central node, and maxima at $L/4,3L/4$. The second excited state $n=3$ has energy $9E_1$, nodes at $L/3,2L/3$, and maxima at $L/6,L/2,5L/6$.

There is no normalized $n=0$ state: that choice gives the zero function. The original wells figure shows all three <wavefunctions> and <probability densities>. An arbitrary overall <wavefunction> sign does not affect the probability distribution.