Back to the on-screen lesson ·
Three quadrature rules from integrating an interpolant, the degree each is exact on, and the weighted combination in which two of the errors cancel.
Paper packet. Every task here also exists on screen, where it is checked automatically; answers written on paper are not assessed by Nydus. When you are back at a device, enter your answers there.
By the end of this lesson you will be able to apply the trapezoid, midpoint and Simpson rules, state the degree of polynomial each integrates exactly, explain why Simpson's rule reaches one degree higher than the curve it fits, and say why a cubic is a useless test of it.
You can integrate a polynomial exactly, and you know that an interpolating polynomial agrees with a function at its nodes. A quadrature rule is what you get by integrating the interpolant instead of the function.
A quadrature rule estimates an integral as a weighted sum of function values. Its degree of exactness is the highest degree of polynomial it integrates exactly. A panel is one subinterval; a rule is composite when it is applied to each panel and the results added. A rule is closed when it samples the endpoints and open when it does not.
Integrate the interpolant rather than the function. Through the two endpoints that gives the trapezoid rule $\dfrac{b-a}{2}\big(f(a) + f(b)\big)$, exact on straight lines, with error $-\dfrac{(b-a)^{3}}{12}f''(\xi)$ — too large when the curve bends upwards, because the chord lies above it. Through the single midpoint it gives the midpoint rule $(b-a)f\!\left(\tfrac{a+b}{2}\right)$, also exact on straight lines, with error $+\dfrac{(b-a)^{3}}{24}f''(\xi)$: the opposite sign and half the size. Those two facts together are the whole of Simpson's rule, because the weighted average that cancels both errors is $\dfrac{2M + T}{3} = \dfrac{b-a}{6}\big(f(a) + 4f(\tfrac{a+b}{2}) + f(b)\big)$. Simpson's rule fits a parabola and is exact to degree three: the cubic part of the error is odd about the midpoint and integrates away for free. Its error is $-\dfrac{(b-a)^{5}}{2880}f^{(4)}(\xi)$, so a quartic is the first integrand it gets wrong — and therefore the first honest test of an implementation.
Another way: picture
Draw a curve bending upwards over one panel. The chord from end to end sits above it, leaving a sliver of overestimate; the flat line at the midpoint height sits below, leaving a sliver of underestimate that is half the size. Weight them two to one in favour of the smaller error and the slivers cancel.
Another way: steps
The degree of exactness of a rule is not the degree of the curve it fits. Simpson's rule fits a parabola and integrates cubics exactly; the Gauss rules do better still with the same number of samples. The extra degree comes from symmetry, not from the fit, and it is the reason a test of quadrature code must use a polynomial above the rule's degree of exactness — a cubic test of Simpson's rule reports zero error at every panel count and measures nothing whatever.
Over one panel the trapezoid error is $-\tfrac{h^{3}}{12}f''$ and the midpoint error is $+\tfrac{h^{3}}{24}f''$.
Opposite signs, sizes in the ratio 2:1.
So $\tfrac{2M + T}{3}$ has error $\tfrac{2(h^{3}/24) - h^{3}/12}{3} f'' = 0$ to this order.
The leading terms annihilate.
What is left is the $f^{(4)}$ term, and the combination is Simpson's rule.
Two crude rules make one good one.
$\int_0^{2} x^{3} = 4$. Simpson: $\tfrac{2}{6}(0 + 4 \times 1 + 8) = 4$.
Exact.
Trapezoid gives $\tfrac{2}{2}(0 + 8) = 8$ and midpoint gives $2 \times 1 = 2$.
Errors $+4$ and $-2$.
And $\tfrac{2 \times 2 + 8}{3} = 4$: the cancellation, in numbers.
The ratio holds exactly here.
Trapezoid: $\tfrac12(0 + 1) = \tfrac12$, against the true $\tfrac13$.
Midpoint: $1 \times \tfrac14 = \tfrac14$, an error of $-\tfrac{1}{12}$ against the trapezoid's $+\tfrac16$.
And $\tfrac{2 \times \frac14 + \frac12}{3} = \tfrac13$: Simpson, exact.
Estimate $\displaystyle\int_0^{2} x^{3}\,dx$, whose exact value is $4$, by each of the three rules on the whole interval. Give the estimate and the error of each, as fractions where they are not whole numbers.
| Estimate | Error | |
|---|---|---|
| Trapezoid rule | ||
| Midpoint rule | ||
| Simpson's rule |
Simpson's rule on $[0, 4]$ fits a parabola through the two ends and the midpoint. On which polynomials does it give the exact integral?
Four rules are applied to $\displaystyle\int_0^{6} f$ with a curve that bends upwards throughout. Match each to what it does.
| Exact on constants only, with an error proportional to the panel width | Exact on straight lines, and too large on a curve bending upwards | Exact on straight lines, and too small by half as much | Exact on cubics, although it only ever fits a parabola | |
|---|---|---|---|---|
| The left endpoint rule | ||||
| The trapezoid rule | ||||
| The midpoint rule | ||||
| Simpson's rule |
Simpson's rule is to be applied with about $18$ panels. Put the five steps into order.
Number the steps in order (write the number in the box):
Apply Simpson's rule on the whole interval to $\displaystyle\int_0^{1} x^{4}\,dx$. By how much does it miss the exact value? Give a fraction.
Answer:
Lesson test: one question per skill, one attempt each, no hints. Your answers are checked when you submit.
Estimate $\displaystyle\int_0^{5} x^{2}\,dx$ by the trapezoid rule on two equal panels, and give the error. Write each as a fraction where it is not a whole number.
Estimate est, error err
You can apply all three rules and give the degree of exactness and the error sign of each. Say in your own words why Simpson's rule is the weighted average of the other two.
8. Your turn: the trapezoid and midpoint estimates of $\int_0^{1} x^{2}$, step 3