Solution (source code)

= Solution

For a nonzero integer mode, normalize the <wavefunction>:
$$
1=|A|^2\int_0^L\sin^2\frac{n\pi x}{L}\,dx=|A|^2\frac L2.
$$
Thus \b[$|A|=\sqrt{2/L}$]. Choosing an arbitrary overall <phase> makes $A=\sqrt{2/L}$ real and positive. The physical modes are conventionally indexed $n=1,2,\ldots$; $n=0$ would be the zero function and cannot be normalized.