The trapezoidal rule approximated an integral by integrating an interpolating linear polynomial. Given three points, why not find and integrate the interpolating quadratic polynomial? The Newton-Cotes rules discussed in this topic take this and higher order interpolating polynomials to approximate an integral.

# Theory

For the trapezoidal rule, we approximated the integral
on the given interval [*a*, *b*] by finding the
polynomial interpolating the two end points and integrating that
result. This is demonstrated in Figure 1.

Figure 1. The trapezoidal rule.

The generalization to this is obvious: find an interpolating polynomial of higher degree and integrate the resulting polynomial. The processes of interpolating equally-spaced pointed are collectively known as Newton-Cotes rules, however, the lower degree polynomials have specific names:

Table 1. Interpolating polynomial degree and named integration rules.

Points | Name |
---|---|

2 | Trapezoidal rule |

3 | Simpson's rule |

4 | Simpson's 3/8th rule |

5 | Boole's rule |

# Simpson's Rule

Given the interval [*a*, *b*], let *h* = (*b* - *a*)/2 and
find the quadratic polynomial interpolating the three points (*a*, f(*a*)),
(*a* + *h*, f(*a* + *h*)), and (*b*, f(*b*))
and integrate it. Figure 2 shows a function and the interpolating quadratic polynomial.

Figure 2. Simpson's rule.

# Simpson's 3/8th Rule

Given the interval [*a*, *b*], let *h* = (*b* - *a*)/3 and
find the cubic polynomial interpolating the four points (*a*, f(*a*)),
(*a* + *h*, f(*a* + *h*)), (*a* + 2*h*, f(*a* + 2*h*)), and (*b*, f(*b*))
and integrate it. Figure 3 shows a function and the interpolating cubic polynomial.

Figure 3. Simpson's 3/8th rule.

# Boole's Rule

Given the interval [*a*, *b*], let *h* = (*b* - *a*)/4 and
find the quartic polynomial interpolating the five points (*a*, f(*a*)),
(*a* + *h*, f(*a* + *h*)), (*a* + 2*h*, f(*a* + 2*h*)), (*a* + 3*h*, f(*a* + 3*h*)), and (*b*, f(*b*))
and integrate it. Figure 4 shows a function and the interpolating quartic polynomial.

Figure 4. Boole's rule.

You will note that this is the area of a trapezoid of height *b* - *a* with
sides of width f(*a*) and f(*b*).

You will note that we do not actually carry out the integrations. This is because the entire process is extremely tedious and simply an exercise in book keeping. To see the derivations of these formulae, you can view this (rather large) Maple Worksheet. As well as showing Simpson's, Simpson's 3/8th, and Boole's rules, it also shows an 11-point Newton-Cotes Rule which has negative coefficients in the numerator. Negative coefficients can result in subtractive cancellation, and therefore higher point Newton-Cotes polynomials are not often used in general.

# Composite Newton-Cotes Rules

Just like the trapezoidal rule can be repeated on a given interval, the Newton-Cotes rules can be repeated. This generalization is left to the reader.

# HOWTO

# Problem

Given a function of one variable, f(*x*), find the integral
of the curve on the interval [*a*, *b*].

# Assumptions

None.

# Tools

We will use sampling and polynomial interpolation.

# Process

## Simpson's Rule

Given f(*x*), *a*, and *b*, let *h* = (*b* − *a*)/2 and calculate

## Simpson's 3/8th Rule

Given f(*x*), *a*, and *b*, let *h* = (*b* − *a*)/3 and calculate

## Bools's Rule

Given f(*x*), *a*, and *b*, let *h* = (*b* − *a*)/4 and calculate

Due to a typo in a common reference, Bo*ol*e's rule is mistakenly referred to as Bo*d*e's rule.

# Examples

# Example 1

Use Simpson's Rule to approximate the integral of f(*x*) = *x*^{3} 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(h^{4}) 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.

# Engineering

Given data which is being read sequentially for which there is no possibility of sub-sampling, it is best to approximate the integral of the data by taking each triplet of points and applying Simpson's rule.

By using sets of four points and Simpson's 3/8 rule, the error is, in fact, larger.

Consider sampling the damped oscillator f(*x*) = e^{-0.2x} sin(*x*)
at each of the integers from 0 to 6.
Figure 1 shows the composite trapezoidal rule is used to approximate the integral using
trapezoids on each of the 6 intervals. Figure 2 shows Simpson's rule applied using
three quadratic polynomials on the intervals [0, 2], [2, 4], and [4, 6]
which are integrated to approximate the integral. Figure
3 shows the two cubic polynomials used by Simpson's 3/8th rule on the intervals
[0, 3] and [3, 6]. The actual area is approximately 0.699648, and thus we see
that Simpson's rule does have the smallest error (the error being approximately
2.39 times smaller for Simpson's rule as compared to Simpson's 3/8th rule).

Figure 1. Approximation using repeated applications of the trapezoidal rule.

Figure 2. Approximation using repeated applications of Simpson's rule.

Figure 3. Approximation using repeated applications of Simpson's 3/8th rule.

# Error

It is beyond the scope of this course, but the errors associated with
each of the methods are given in terms of the width between the points (*h*)
and the width of the intervals being integrated over (*b* - *a*).

The symbol ξ is in the interval [*a*, *b*].

# Questions

# Question 1

Approximate the integral of f(x) = e^{-x} on [0, 10] using
Simpson's Rule and Simpson's 3/8 Rule.

Answer: 1.711661979876841 and 1.388606601719423.

# Question 2

Approximate the integral of f(x) = x^{2} on the interval [0, 2]
using Simpson's Rule and Simpson's 3/8 Rule.

Answer: 8/3 (or 2.666666666666667) in both cases.

# Question 3

Approximate the integral of f(x) = x^{4} on the interval [0, 2]
using Simpson's Rule and Simpson's 3/8 Rule.

Answer: 20/3 = 6.666666666666667 and 176/27 = 6.518518518518516.

# Question 4

What is the estimated error for the approximation in Question 3 what is the actual error? Is this exact, and why?

Answer: Because the 4th derivative is a constant, the errors may be found exactly: -4/15 and -16/135.

# Matlab

Finding an approximation of an integral using Simpson's rule and
Simpson's 3/8th rule
of a function f(*x*) = cos(*x*) on the interval [0, 1.5]:

>> (cos(0) + 4*cos(0.75) + cos(1.5))/6 * 1.5 ans = 0.999373169290747 >> (cos(0) + 3*cos(0.5) + 3*cos(1.0) + cos(1.5))/8 * 1.5 ans = 0.998323463426858

The correct answer is sin(1.5) ≈ 0.997494986604054 .

# Maple

The following commands in Maple:

with( Student[Calculus1] ): ApproximateInt( cos(x), x = 0.0..1.5, method = trapezoid, output = plot, partition = 1 );

produces the plot shown in Figure 1.

Figure 1. The trapezoidal rule applied to integrating cos(x) on [0, 1.5].

For more help on approximating integrals or on the Student[Calculus1] package, enter:

?ApproximateInt ?Student,Calculus1

Copyright ©2005 by Douglas Wilhelm Harder. All rights reserved.