integral of cos^2((n-(1/2)) pi x) dx between 0 and 1