4.6Numerical Integration
Trapezoidal Rule Area of a Trapezoid
h
b1
b2
( )212
1bbhArea +=
h
b1 b2
We are going to sum upn trapezoids from a to b.
a b
Let’s let n = 4 (4 trapezoids)
x0 x1 x2 x3 x4
h
n
abh
−=
Now we need to find thesums of the area of these four trapezoids.
( ) ( )( )102xfxf
n
abA +
−=
( ) ( )( )212xfxf
n
ab+
−+ ( ) ( )( )432
... xfxfn
ab+
−++
simplified to
( ) ( ) ( ) ( ) ( )( )nn xfxfxfxfxfn
ab+++++
−= −1210 2...22
2
∫∞→≈
b
an
dxxf )(lim
The bigger n you use, the more accurate your answerwill be.
Use the Trapezoidal Rule to approximate
4sin0
=∫ nLetxdxπ
π
1
04
π2
π4
3π4
0−=
−=
πnab
h
( ) ( )⎟⎟⎠
⎞⎜⎜⎝
⎛+⎟⎠
⎞⎜⎝
⎛+⎟⎠
⎞⎜⎝
⎛+⎟⎠
⎞⎜⎝
⎛+= πππππfffffArea
4
32
22
420
4)2(
( ) ⎟⎟⎠
⎞⎜⎜⎝
⎛+⎟⎟⎠
⎞⎜⎜⎝
⎛++⎟⎟
⎠
⎞⎜⎜⎝
⎛+= 0
2
2212
2
220
8
π 896.1≈
Simpson’s Rule
n is even
⎥⎦
⎤⎢⎣
⎡
++++++−
=−
∫ )()(4...
)(4)(2)(4)(
3)(
1
3210
nn
b
a xfxf
xfxfxfxf
n
abdxxf
Note: The coefficients in Simpson’s Rule have the followingpattern
1 4 2 4 2 4 … 4 2 4 2 4 1
Ex. dxx∫π
0
sin
Let n = 4
0 π4
π2
π4
3π
=∫ dxxπ
0
sin ( ) ⎥⎦
⎤⎢⎣
⎡ ++++ πππππsin
4
3sin4
2sin2
4sin40sin
43
€
=π12
0 + 2 2 + 2 + 2 2 + 0[ ] 005.2≈
if n = 8 0003.2.≈Ans
€
sin x0
π
∫ dx = −cos x]0
π= 2