Example 1
Use Simpson's Rule to approximate the integral of f(x) = x3 on the interval [1, 2].
1/6 (f(1) + 4 f(1.5) + f(2))(2 - 1) = 3.75
The actual value of the integral is 3.75. This is exact because the error for Simpson's rule is O(h4) and we are integrating a cubic function.
Example 2
Use Simpson's Rule to approximate the integral of f(x) = e-0.1 x on the interval [2, 5].
1/6 (f(2) + 4 f(3.5) + f(5))(5 - 2) = 2.122006886
The actual value of the integral is 2.122000934 .
Example 3
Suppose we can only evaluate a function at the integers (for example, when we are periodically sampling a signal). Use three applications of Simpson's Rule and two applications of Simpson's 3/8 Rule to approximate the integral of response with a decaying transient f(x) = cos(x) + x e−x on the interval [0, 6].
Thus, we calculate:
and
The actual integral is -7 exp(-6) + sin(6) + 1 = 0.7032332366, and therefore, three applications of Simpson's rule with intervals of width 2 appears to be more accurate than two applications of Simpson's 3/8th rule with intervals of width 3.
Copyright ©2005 by Douglas Wilhelm Harder. All rights reserved.