Article 763CJ Integrating smooth periodic functions

Integrating smooth periodic functions

by
John
from John D. Cook on (#763CJ)

Several posts lately have looked at the function

f(x) = cos(sin(x) +x).

This post will look at the function from a different angle. It's a smooth function with period 2. For reasons I wrote about here, this means that the trapezoid rule should find its integral very efficiently.

In general, the error in the trapezoid rule is on the order of 1/N^2 whereN is the number of integration points. To be more specific, the error in integrating a function f over [a, b] with N points is bounded by

(b - a)^3 M / 12N^2

where M is the maximum absolute value of the second derivative of f. So in our case we should expect the error to be less than 82.67/N^2. In fact we domuch better than that. The error does not decrease quadratically, as it does in general, but exponentially.

periodic_gaussian.png

With just 16 integration points, we've reached the limit of floating point representation.

The post Integrating smooth periodic functions first appeared on John D. Cook.
External Content
Source RSS or Atom Feed
Feed Location http://feeds.feedburner.com/TheEndeavour?format=xml
Feed Title John D. Cook
Feed Link https://www.johndcook.com/blog
Reply 0 comments