How good are Riemann sums for periodic functions?

by greenturtle3141, Nov 14, 2024, 10:22 PM

Let $f:\mathbb{R} \to \mathbb{R}$ be periodic (say, 1-periodic) and smooth. Our goal is to approximate $\int_0^1 f\,dx$. Here are the first two ways that come to mind:
  • Use a left (or right) Riemann sum:
    $$\int_0^1 f\,dx \approx \frac{1}{n}\sum_{k=0}^{n-1} f(k/n)$$
  • Use a trapezoidal Riemann sum:
    $$\int_0^1 f\,dx \approx \frac{1}{n}\sum_{k=0}^{n-1} \frac{f(k/n)+f((k+1)/n)}{2}$$
How good is each approximation as $n \to \infty$? In other words, if $S_n$ is the approximation and $I$ is the integral, how does $|I-S_n|$ decay? What is the largest exponent $p$ such that $|I-S_n| \leq \frac{C_p}{n^p}$ for some constant $C_p > 0$ (that is allowed to depend on $f$)? Are there any schemes that induce an even faster convergence?

Try to guess the answer before moving on.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.

.


Ok time's up.

Theorem: Let $f:\mathbb{R} \to \mathbb{R}$ be smooth and 1-periodic. Then
$$\left|\int_0^1 f\,dx - \frac{1}{n}\sum_{k=0}^{n-1} f(k/n)\right| = O(1/n^p)$$for every $p > 1$!


So you're not going to do better than the classic Riemann sum. I leave as an exercise to show that "any scheme" will also achieve this extremely rapid decay.

(By the way, did you notice that left, right, and trapezoidal Riemann sums are all completely identical for periodic functions?)

Proof. By periodicity we may consider the Fourier series
$$f(x) = \sum_{m \in \mathbb{Z}} a_me^{-2\pi imx}.$$By smoothness the above relationship is a "true" pointwise equality, holding for every $x$. Now take the left Riemann sum of both sides to find
$$\frac{1}{n}\sum_{k=0}^{n-1} f(k/n) = \frac{1}{n}\sum_{k=0}^{n-1}\sum_{m \in \mathbb{Z}} a_me^{-2\pi imk/n}$$$$ = \sum_{m \in \mathbb{Z}} a_m \cdot \frac1n\sum_{k=0}^{n-1} e^{-2\pi imk/n}$$where the interchange is justified (why?). But observe that
$$\frac1n\sum_{k=0}^{n-1} ae^{-2\pi imk/n} = \begin{cases}1, & n \mid m \\ 0, & \text{otherwise}\end{cases},$$hence
$$\frac{1}{n}\sum_{k=0}^{n-1} f(k/n) = \sum_{m \in \mathbb{Z}, n \mid m} a_m = \sum_{j \in \mathbb{Z}} a_{jn}$$$$ = \int_0^1 f\,dx + \sum_{j \in \mathbb{Z} \setminus \{0\}} a_{jn}.$$Since $f$ is smooth, the Fourier coefficients decay rapidly; say, $|a_m| \leq C_p/|m|^p$ for $p$ as large as we wish. Then the error is bounded as
$$\left|\sum_{j \in \mathbb{Z} \setminus \{0\}} a_{jn}\right| \lesssim \sum_{j=1}^\infty \frac{1}{j^pn^p} \sim \frac{1}{n^p}$$for $p$ as large as we wish. $\square$.

We can also try this trick for $f$ not necessarily periodic. If $f$ is integrable and continuous then we may safely apply Poisson summation to the function $x \mapsto f(x/n)$ to find
$$\frac1n\sum_{m \in \mathbb{Z}} f(m/n) = \sum_{m \in \mathbb{Z}} \hat{f}(nm).$$(Recall that if $g(x) = f(x/a)$ then $\hat{g}(\xi) = a\hat{f}(a\xi)$.) The LHS is a Riemann sum using rectangles of width $1/n$ and the error is then given by $\sum_{m \in \mathbb{Z} \setminus \{0\}} \hat{f}(nm)$, which is smaller the more regular $f$ is. In particular if $f \in C^k$ then we can expect the error to be of order $O(1/n^k)$.

Comment

J
U VIEW ATTACHMENTS T PREVIEW J CLOSE PREVIEW rREFRESH
J

0 Comments

Turtle math!

avatar

greenturtle3141
Archives
+ October 2024
Shouts
Submit
  • Can you give some thought to dropping a guide to STS? Just like how you presented your research (in your paper), what your essays were about, etc. Also cool blog!

    by Shreyasharma, Mar 13, 2025, 7:03 PM

  • this is so good

    by purpledonutdragon, Mar 4, 2025, 2:05 PM

  • orz usamts grader

    by Lhaj3, Jan 23, 2025, 7:43 PM

  • Entertaining blog

    by eduD_looC, Dec 31, 2024, 8:57 PM

  • wow really cool stuff

    by kingu, Dec 4, 2024, 1:02 AM

  • Although I had a decent college essay, this isn't really my specialty so I don't really have anything useful to say that isn't already available online.

    by greenturtle3141, Nov 3, 2024, 7:25 PM

  • Could you also make a blog post about college essay writing :skull:

    by Shreyasharma, Nov 2, 2024, 9:04 PM

  • what gold

    by peace09, Oct 15, 2024, 3:39 PM

  • oh lmao, i was confused because of the title initially. thanks! great read

    by OlympusHero, Jul 20, 2024, 5:00 AM

  • It should be under August 2023

    by greenturtle3141, Jul 11, 2024, 11:44 PM

  • does this blog still have the post about your math journey? for some reason i can't find it

    by OlympusHero, Jul 10, 2024, 5:41 PM

  • imagine not tortoise math

    no but seriously really interesting blog

    by fruitmonster97, Apr 2, 2024, 12:39 AM

  • W blog man

    by s12d34, Jan 24, 2024, 11:37 PM

  • very nice blog greenturtle it is very descriptive and fascinating to pay attention to :-D

    by StarLex1, Jan 3, 2024, 3:12 PM

  • orz blog

    by ryanbear, Dec 6, 2023, 9:23 PM

67 shouts
Tags
About Owner
  • Posts: 3552
  • Joined: Oct 14, 2014
Blog Stats
  • Blog created: Oct 23, 2021
  • Total entries: 54
  • Total visits: 40421
  • Total comments: 126
Search Blog
a