Simpson`s Rule is a three point formula (at A, B and the midpoint

Simpson’s Rule
is a three point formula (at A, B and the midpoint). Replace y(x) by a Lagrange
interpolating quadratic:
A+B
2 )(x − B)
y(A) +
A−B
2 (A − B)
(x − A)(x − A+B
2 )
+
y(B)
B−A
(B − A) 2
(x −
(x − A)(x − B) A+B
y( 2 )
B−A A−B
· 2
2
Integrate (individually) from A to B:
Z
B
(x −
A
=
(x −
Z
¯B
(A−B)3
6
+
x=A
=
−
B
A
(B−A)3
12
(x − A)(x − B) dx
¯
2 ¯B
(x − A) (x−B)
¯
2
x=A
−
1
2
3
= − (B−A)
6
Z
=
Z
1
2
(x − B)2 dx
B
A
=
− B) dx
2
A+B (x−B) ¯
¯
2 )
2
(B−A)3
4
=
A+B
2 )(x
2
(x−A)
2
Z
B
A
(x − B)2 dx
B
A
(x − A)(x −
(x −
¯B
A+B ¯
)
¯
2
x=A
3
A+B
2 ) dx
−
3
1
2
Z
B
A
(x − A)2 dx
3
− (B−A)
= (B−A)
= (B−A)
4
6
12
and combine, to get the following formula (Simpson’s):
Z
B
A
y(x) dx ≈
y(A) + 4y( A+B
2 ) + y(B)
· (B − A)
6
The first term is a weighted average of the three y-values, the mid point contributing
4 times as much as the other two.
The formula must be exact for polynomials of degree 2 or less, due to symmetry, it
is also correct for all cubics (due to its symmetry):
1
y(x):
1
x
x2
x3
x4
Simpson:
1+4+1
=1
6
0+4· 12 +1
= 12
61
0+4· 4 +1
= 13
6
0+4· 18 +1
= 14
61
0+4· 16
+1
5
= 24
6
Exact:
R1
dx = 1
R 10
x
dx = 12
R 01 2
x dx = 13
R01 3
x dx = 14
R01 4
x dx = 15
0
(off by about 4%).
Idea as to how to derive the Simpson-rule coefficients more efficiently: The formula
must be exact for all quadratics, and it has the form:
¤
£
cl y(A) + cc y( A+B
2 ) + cr y(B) (B − A)
Apply it to y(x) = 1, x and x2 , using A = −1 and B = 1 (the most convenient
choice now), and get:
y(x):
Formula:
Exact:
1
2(cl + cc + cr )
2
x
2(cr − cl )
0
2
x2
2(cr + cl )
3
1
2
which is solved by cl = cr = 6 , cc = 3 (same as before). Note the symmetry of cl and
cr .
Error Analysis:
Applying the Simpson rule to Taylor expanded y(x) yields
µ
h y 00 (xc ) h2 y 000 (xc ) h3 y iv (xc ) h4
1
y(xc ) + y 0 (xc ) +
+
+
6
2
2
4
6
8
24 16
+4y(xc )
¶
h y 00 (xc ) h2 y 000 (xc ) h3 y iv (xc ) h4
+y(xc ) − y 0 (xc ) +
−
+
·h=
2
2
4
6
8
24 16
y(xc ) h +
The error is thus
y 00 (xc ) 3 y iv (xc ) 5
h +
h + ...
24
1152
y iv (xc ) 5
h + ...
2880
(a substantial improvement over the trapezoidal rule).
R π/2
And, true enough, applying Simpson to the old 0 sin x dx yields 1.002279877,
a fairly respectable answer.
Composite Rule:
Divide (A, B) into n2 subintervals (n must be even). Apply Simpson to each subinterval, add the answers:
2
y0 + 4y1 + y2
y2 + 4y3 + y4
h+
h+
6
6
yn−2 + 4yn−1 + yn
.... +
h=
6
y0 + 4y1 + 2y2 + 4y3 + ... + 4yn−1 + yn
· (B − A)
3n
where h =
B−A
n
2
=
2
n (B
− A).
The corresponding error is:
n/2
h5 X iv
y (x2i−1 ) + ... '
2800 i=1
=
h5 n iv
· y + ...
2800 2 av
h4
iv
+ ...
(B − A) yav
2800
(next terms proportional to h6 , h8 ,...).
This gives us a clear idea as to how to apply Romberg’s algorithm.
Example:
R1
Apply the Simpson composite rule to 0 sin x dx:
n
2
4
8
16
−Ii
Ki = 16Ii+1
Ii
15
1. 00227 9878 0.99999 15654
1. 00013 4585 0.99999 98774
1. 00000 8296 0.99999 9998
1. 00000 0517
where
n
1+4
Ii =
2
P
j=1
sin π (2j−1)
+2
2n
3n
3
n
2 −1
P
j=1
−Ki
Li = 64Ki+1
63
1. 00000 0009
0.99999 99997
sin π2(2j)
n
·
π
2