## Topic 13.4: Newton-Cotes Rules (Examples)

Introduction Notes Theory HOWTO Examples Engineering Error Questions Matlab Maple

# 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 ex on the interval [0, 6].

Thus, we calculate:

1/6 (f(0) + 4 f(1) + 2 f(2) + 4 f(3) + 2 f(4) + 4 f(5) + f(6)) 2 = 0.6876458772

and

1/8 (f(0) + 3 f(1) + 3 f(2) + 2 f(3) + 3 f(4) + 3 f(5) + f(6)) 3 = 0.6723034556

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.