Solution (source code)

= Solution

The spatial <quantum phase> has unit modulus. Thus the <probability density> and total <probability> are
$$
|\Psi(x,0)|^2=\frac2a\sin^2\frac{\pi x}{a},\qquad \boxed{\int_{-\infty}^{\infty}|\Psi(x,0)|^2\,dx=\frac2a\int_0^a\sin^2\frac{\pi x}{a}\,dx=1.}
$$
The exterior contributes zero. This establishes <wavefunction normalization>, although the spatial <quantum phase> means the state is not the ground <energy eigenstate>.