Solution (source code)

= Solution

The squared sine has integral $a$ over the interval of length $2a$, since it contains an integer number of half-wavelengths. A real positive phase convention therefore gives
$$
\boxed{\alpha_n=\frac1{\sqrt a}.}
$$
Inside the <infinite square well>, the <Time-independent Schrödinger equation> is $-\hbar^2\psi_n''/(2m)=E_n\psi_n$. The wavenumber is $\pi n/(2a)$, so
$$
\boxed{E_n=\frac{\hbar^2\pi^2n^2}{8ma^2},\qquad n\geq1.}
$$
The <stationary states> vanish at both walls and form an <orthonormal basis> of the square-integrable state space. A common arbitrary phase on each basis function does not alter any energy or measurement probability.