While reading a paper in mathematical physics (I am a physicist) I stumbled upon this statement :
Note first that in the case of variables $q_j$, $1 \leq j\leq N$ which are homogeneously distributed inside an interval of length $\pi$ (i.e. $q_{j+1}-q_j=\frac{\pi}{N}$) such that f(q) is $\pi$-periodic, it is easy to prove the following proposition :
$\frac{1}{M}\sum\limits_{j=1}^Nf(q_j)=\frac{1}{2\pi}\int\limits_{-\frac{\pi}{2}}^{\frac{\pi}{2}}f(q)dq + O(M^{-\infty})$
(they didn't mention that f(q) is $\mathcal{C}^{\infty}$ because it is clear in the rest of the paper that it is the case)
I tried to get the result in a simpler context with :
$f(x)$ is $\mathcal{C}^{\infty}$ with period $1$ trying to get :
$\frac{1}{n}\sum \limits_{j=1} ^n f(\frac{j}{n})= \int\limits_0^1f(x)dx+ O(n^{-\infty})$
Can anyone somehow show me how to prove this ? (or help me find a book/paper where it is explained in more details)
here is my attempt at getting the result
I start from $\int\limits_0^1f(x)dx$ and rewrite it as the following sum (which I believe is a Riemann sum):
$\int\limits_0^1f(x)dx = \sum \limits_{j=0}^{n-1}\int\limits_{0}^{\frac{1}{n}}f(\frac{j}{n}+x)dx$
Then I taylor expand the RHS of the equation to get the following:
$\int\limits_0^1f(x)dx = \sum \limits_{j=0}^{n-1}\int\limits_{0}^{\frac{1}{n}}\left(f(\frac{j}{n})+x f'(\frac{j}{n}) + \frac{x^2}{2!}f''(\frac{j}{n})+ \frac{x^3}{3!}f'''(\frac{j}{n})+ ...\right)dx$.
Which is the same as : $\int\limits_0^1f(x)dx = \sum \limits_{j=0}^{n-1}\int\limits_{0}^{\frac{1}{n}}f(\frac{j}{n})dx+\sum \limits_{j=0}^{n-1}\int\limits_{0}^{\frac{1}{n}}x f'(\frac{j}{n})dx +\sum \limits_{j=0}^{n-1}\int\limits_{0}^{\frac{1}{n}} \frac{x^2}{2!}f''(\frac{j}{n})dx+\sum \limits_{j=0}^{n-1}\int\limits_{0}^{\frac{1}{n}} \frac{x^3}{3!}f'''(\frac{j}{n})dx+ ...$
Now evaluating the integral at each term I get :
$\int\limits_0^1f(x)dx = \sum \limits_{j=0}^{n-1}f(\frac{j}{n})\frac{1}{n}+\sum \limits_{j=0}^{n-1}\frac{1}{2n^2} f'(\frac{j}{n}) +\sum \limits_{j=0}^{n-1} \frac{1}{2!} \frac{1}{3n^3}f''(\frac{j}{n})+\sum \limits_{j=0}^{n-1} \frac{1}{3!} \frac{1}{4n^4}f'''(\frac{j}{n})+ ...$
And finally, taking the first term on the RHS to the LHS I get :
$\frac{1}{n}\sum \limits_{j=0}^{n-1}f(\frac{j}{n})=\int\limits_0^1f(x)dx - \left(\sum \limits_{j=0}^{n-1}\frac{1}{2n^2} f'(\frac{j}{n}) +\sum \limits_{j=0}^{n-1} \frac{1}{2!} \frac{1}{3n^3}f''(\frac{j}{n})+\sum \limits_{j=0}^{n-1} \frac{1}{3!} \frac{1}{4n^4}f'''(\frac{j}{n})+ ...\right)$ [1]
Which is the furthest I can get till now.
My idea to move forward is the following :
I take the first term from the parenthesis of equation [1]: $\sum \limits_{j=0}^{n-1}\frac{1}{2n^2} f'(\frac{j}{n})$ and since the derivative of a periodic function is also periodic I can apply [1] to this term and thus get :
$\frac{1}{2n} \frac{1}{n}\sum \limits_{j=0}^{n-1} f'(\frac{j}{n}) =\frac{1}{2n} \left(\int\limits_0^1f'(x)dx - \left(\sum \limits_{j=0}^{n-1}\frac{1}{2n^2} f''(\frac{j}{n}) +\sum \limits_{j=0}^{n-1} \frac{1}{2!} \frac{1}{3n^3}f'''(\frac{j}{n})+...\right)\right)$
We know that $\int\limits_0^1f'(x)dx =f(1)-f(0)=0$ (period $1$ of $f(x)$) so we are left with the other terms which now are of one lower order in n ($n^{-2}\rightarrow n^{-3}$).
Applying this recursively to all the terms in [1] should always get me to one lower order in n and thus the correction should be of $O(n^{-\infty})$ which leads to the final result of :
$\frac{1}{n}\sum \limits_{j=1} ^n f(\frac{j}{n})= \int\limits_0^1f(x)dx+ O(n^{-\infty})$ such that when $n \rightarrow \infty$ we have $\frac{1}{n}\sum \limits_{j=1} ^n f(\frac{j}{n})= \int\limits_0^1f(x)dx$