Simpson's rule fits a parabola through each pair of strips. It needs an even number of strips and gives the weights 1,4,2,4,…,2,4,1
Lesson 2 of 3Show all lessonsHide
Try the code and the simulations beside the lesson.
What you will be able to do
use Simpson's rule from a formula or a table;
explain why it is exact for cubics and how its error depends on h;
improve trapezium estimates by Richardson's method and judge how accurate a result is.
Bend the tops
The trapezium rule uses straight tops. A curve is rarely straight, but over a short piece it looks very like a parabola. So fit a parabola through three neighbouring points, and use the area under it.
Simpson's rule
Through the points at x=−h, 0 and h, with heights y0, y1, y2, there is one parabola. The area under it is
∫−hh(A+Bx+Cx2)dx=2Ah+32Ch3.
Since y0+y2=2A+2Ch2 and y1=A, this equals 3h(y0+4y1+y2). Repeating over pairs of strips gives Simpson's rule, for an evenn:
Sn=3h[y0+yn+4(y1+y3+⋯)
+2(y2+y4+⋯)].
The weights run 1,4,2,4,2,…,4,1. For ∫12xdx with 4 strips, S4≈0.693254, only about 0.0001 above ln2.
A curve over two strips from -h to h, with its three ordinates y0, y1 and y2 marked. A dashed parabola passes through the three tops and nearly matches the curve. Labels give the weights 1, 4 and 1 under the three ordinates.
Exact for cubics
The rule is built to be exact for parabolas. It is exact for cubics too. On [−h,h], the term Dx3 is odd, so its integral is 0, and its values at −h, 0, h add, with the weights 1,4,1, to −Dh3+0+Dh3=0. Both sides gain nothing. For f′′′′ continuous, the error is
∫abfdx−Sn=−180(b−a)h4f′′′′(ξ).
The error is proportional to h4. Halving h divides it by about 16.
Two rules make a third
Look at the errors of the last lesson: the error of Mn is about −21 times the error of Tn. A weighted average cancels them:
S2n=32Mn+Tn.
This is exactly Simpson's rule with 2n strips. In the same way, the error of T2n is about a quarter of the error of Tn, and
34T2n−Tn=S2n.
This trick of removing the leading error is Richardson's extrapolation. Applied again and again, it is Romberg's method.
How do we know an answer is right?
In practice we do not know the exact value. So we compute Sn and S2n and compare them. The error of S2n is about 151 of their difference. If the difference is 3×10−5, the error of S2n is about 2×10−6.
A worked example from a table
A tank is filled through a pipe. The rate of flow is read every 5 minutes:
Time (min)
Rate (L/min)
0
12
5
15
10
17
15
16
20
13
The strips.h=5min and n=4, which is even.
Simpson.35[12+13+4(15+16)+2(17)]L=35×183L=305L.
Trapezium, to compare.25[12+13+2(48)]L=302.5L.
Read it. The rate curve bends downwards, so the trapezium value is too small, as expected.
Practise with new numbers
Try it in Python
The program applies Simpson's rule to ∫12xdx with more and more strips, and checks that the error falls by about 16 each time.
Common mistakes
An odd number of strips. Simpson's rule pairs the strips, so n must be even.
The weights in the wrong places. The odd-numbered inner ordinates get 4, the even-numbered ones 2.
2h in place of 3h at the front.
Halving h and expecting a quarter of the error. For Simpson it is about a sixteenth.
Remember these
Sn=3h[ends+4×odd+2×even], n even.
Exact for cubics; error in proportion to h4.
S2n=32Mn+Tn=34T2n−Tn.
Error of S2n is about 151(S2n−Sn).
Check yourself
Try each one on your own first. If you are stuck, open a hint. Then check with Show the answer.
Use Simpson's rule with 2 strips on ∫02x3dx.
With T2=0.75 and M2=0.6, what is S4?
With n=4, Simpson's error is 8×10−5. Estimate the error with n=8.
A table has 8 ordinates. Can you use Simpson's rule on all of it?