THP,
I love the fourier series as the functions are simply mind boggli ng.
The fourier series of the function f(x)
a(0) / 2 + (k=1..) (a(k) cos kx + b(k) sin kx)
a(k) = 1/PI f(x) cos kx dx
b(k) = 1/PI f(x) sin kx dx
Remainder of fourier series. Sn(x) = sum of first n+1 terms at x.