integrate (a/2+d)*cos(n*x) dx from -pi to pi