Solution (source code)

= Solution

Using the quadratic form of the <Hamiltonian>,
$E_{av}=(\hbar^2/2m)\int|\psi\prime|^2dx=2\pi^2\hbar^2/(ma^2)$.