3

If I understand it correctly, the Euler-Maclaurin summation formula states that for a periodic and infinitely differentiable function, the error of the trapezoidal rule of the numerical integration of the function over an integer multiple of the period is $$\epsilon = \sum_{k=1}^\infty\frac{B_{2k}}{(2k)!}\left(f^{(2k-1)}(b)-f^{(2k-1)}(a)\right)=0$$ because the upper limit $b$ and lower limit $a$ of the integration differs by an integer multiple of the period.

My question is how can it be true without any requirement on the number of points used in trapezodal rule at all (since this number does not appear in the formula)?

Take the simplest example of using two points only, i.e., $a$ and $b$. There are infinitely many different periodic functions with period $b - a$ and with different values of the definite integral from $a$ to $b$. How could the answer always be $\frac{b-a}{2}\left(f(a)+f(b)\right)$?

The more general question is that the trapezoidal rule computes the function value at some discrete points inside $[a,b]$, and a periodic function can behave in any ways between these discrete points, so why can the trapezoidal rule always give the exact value of the integral?

velut luna
  • 10,162
  • Your question needs more precision I think. What do you mean by "the trapezoidal rule with arbitrary number of points always gives the exact value of the integration" precisely? Certainly, it wouldn't be a good approximator if it couldn't produce the exact integral asymptotically with increasing resolution. Also, here is a very relevant question. – Rollen S. D'Souza May 27 '24 at 00:25
  • Why does it seem to imply that? – Sassatelli Giulio May 27 '24 at 06:23
  • @velutluna The integration interval must coincide with a period of $f$, as the terms in the error expansion has a factor $f^{(2k+1)}(b)-f^{(2k+1)}(a)$. – PierreCarre May 27 '24 at 11:30
  • @RollenS.D'Souza This is not about asymptotics... Compute the value produced by the trapezoidal rule to approximate $\int_0^{2*\pi} (1+ \cos x) dx$ with different number of points and you'll see that iy always yields the exact value of the integral. – PierreCarre May 27 '24 at 11:38
  • @PierreCarre I understand that it can be about that particular fact, but the question was not precise enough which was my point. You are welcome to post an answer. – Rollen S. D'Souza May 27 '24 at 13:07
  • 3
    You should edit your question to better explain it. I think the issue hinges on the difference between an asymptotic expansion and a convergent series, but without more words from you I can't be sure. – Carl Christian May 28 '24 at 15:14

1 Answers1

4

TLDR: There is an error in your reasoning.

To properly address your question:

How could the answer always be $\dfrac{b-a}{2}(f(a)+f(b))$

The answer is: It is not.

Counter example : the cosine function on $[0,2\pi]$. Its integral is $0$, and $$\frac{2\pi}{2}(\cos(0) + \cos(2\pi))= 2\pi \neq 0$$

I think the precise statement about trapezoidal integration of periodic functions you are looking for can be found in

Trefethen, Lloyd N.; Weideman, J. A. C., The exponentially convergent trapezoidal rule, SIAM Rev. 56, No. 3, 385-458 (2014). ZBL1307.65031. available here.

The case of interest to us is what occurs if $v$ and its derivatives are $2\pi$-periodic. Then all the coefficients in the series are zero [...]. This is an interesting asymptotic expansion indeed! One might make the mistake of thinking that it implies that for $2\pi$-periodic $v \in C^\infty(\mathbb{R})$, $I_N$ must be exactly equal to $I$, but this is not true. The correct implication is that in this case $I_N −I$ decreases faster than any finite power of $h$ as $N\rightarrow \infty$.

Semiclassical
  • 18,592
G. Fougeron
  • 1,624