Can I calculate approximately a definite integral of a function by integrating its Fourier Sine Series term-by-term? I'm not sure how to put fancy formulae here because I'm a fairly new user. So bear with me for a moment as we go through a formulae-less reasoning.
1) I have a function $f(x)$.
2) I want to integrate $f(x)$ for $x$ between $0$ and $\pi$.
3) $f(x)$ is a numerical function from $0$ to $\pi$.
4) I take the Discrete Fourier Transform of $f(x)$
5) I now have the coefficients of the fourier series for $f(x)$, which I shall dub $F(x)$.
Can I calculate a definite integral of $f(x)$ from $0$ to $\pi$ by integrating each term of $F(x)$ from $0$ to $\pi$?
 A: If $f$ is $L$-periodic and absolutely continuous on $[0, L]$, then its Fourier series is uniformly convergent and you may integrate term-by-term. You may also use the Weierstrass $M$-test to show that a particular Fourier series converges uniformly. In general, you can integrate infinite series term-by-term if they are either monotone convergent or uniformly convergent. However, if you simply wish to approximate the integral of $f$ you could just replace the infinite Fourier series with the corresponding $N$-th partial sum and integrate term-by-term because $\int_a^b \sum_{n = 1}^N f_n(x) dx = \sum_{n = 1}^N \int _a^b f_n(x) dx$.
A: See Numerical Recipes, Second Ed., Section 13.9.  They recommend uisng an interpolation function $\psi(t)$ between data points, i.e., linear/trapezoidal or cubic. The end result of this is that you may express a Fourier integral in terms of its DFT, but with a multiplier $W$ and endpoint corrections.  The result looks like
$$\int_a^b dt \, f(t) \, e^{i \omega_n t} \approx \Delta e^{i \omega_n a} \left \{ W(\theta) DFT[\{f_0,f_1,\ldots,f_n\}]\\ + \alpha_0(\theta) f_0 + \alpha_1(\theta) f_1+\cdots +e^{i \omega_n (b-a)}[\alpha_{n-2}(\theta) f_{n-2} + \alpha_{n-1}(\theta) f_{n-1}] \right\}$$
where $\theta = \omega_n \Delta$, and $W$ and the $\alpha$'s are analytical functions of $\theta$.
