integrate cos(n*pi*x/L)^2 dx from -L/2 to L/2