Main
Main
J. Robert Buchanan
Department of Mathematics
Spring 2019
Objectives
Now that we have discussed several methods for approximating
definite integrals of the form
Z b
f (x) dx
a
Z d
f (x, y ) dy
c
m/2−1 m/2
k X X
= f (x, y0 ) + 2 f (x, y2j ) + 4 f (x, y2j−1 ) + f (x, ym )
3
j=1 j=1
(d − c) 4 ∂4f
− k (x, µ)
180 ∂y 4
where
d −c
k =
m
yj = c+jk for j = 0, 1, . . . , m
µ ∈ [c, d]
Outer Integration (1 of 2)
Z b Z d
f (x, y ) dy dx
a c
m/2−1 Z b
k b
Z X
= f (x, y0 ) dx + 2 f (x, y2j ) dx
3 a aj=1
m/2 Z b Z b
X
+4 f (x, y2j−1 ) dx + f (x, ym ) dx
j=1 a a
b
(d − c) 4 ∂4f
Z
− k (x, µ) dx
180 a ∂y 4
Outer Integration (2 of 2)
Z b Z d
f (x, y ) dy dx
a c
m/2−1 Z b
k b
Z X
= f (x, y0 ) dx + 2 f (x, y2j ) dx
3 a aj=1
m/2 Z b Z b
X
+4 f (x, y2j−1 ) dx + f (x, ym ) dx
j=1 a a
b
(d − c) 4 ∂4f
Z
− k (x, µ) dx
180 a ∂y 4
b−a
h =
n
xi = a+ih for i = 0, 1, . . . , n
ξj ∈ [a, b]
then
Z b
f (x, yj ) dx
a
n/2−1 n/2
h X X
= f (x0 , yj ) + 2 f (x2i , yj ) + 4 f (x2i−1 , yj ) + f (xn , yj )
3
i=1 i=1
(b − a) 4 ∂4f
− h (ξj , yj )
180 ∂x 4
Quadrature Formula
Z b Z d
f (x, y ) dy dx
a c
n/2−1 n/2
hk X X
≈ f (x0 , y0 ) + 2 f (x2i , y0 ) + 4 f (x2i−1 , y0 ) + f (xn , y0 )
9
i=1 i=1
m/2−1 m/2−1 n/2−1 m/2−1 n/2
X X X X X
+ 2 f (x0 , y2j ) + 2 f (x2i , y2j ) + 4 f (x2i
j=1 j=1 i=1 j=1 i=1
m/2 m/2 n/2−1 m/2 n/2
X X X XX
+ 4 f (x0 , y2j−1 ) + 2 f (x2i , y2j−1 ) + 4 f (x2i−1
j=1 j=1 i=1 j=1 i=1
n/2−1 n/2
X X
+ f (x0 , ym ) + 2 f (x2i , ym ) + 4 f (x2i−1 , ym ) + f (xn , ym )
i=1 i=1
Error
The error term for the double integral Composite Simpson’s rule
quadrature formula takes the form of
(d − c)(b − a) 4 ∂ 4 f 4
4∂ f ˆ
E(f ) = − h (ξ, µ) + k (ξ, µ̂)
180 ∂x 4 ∂y 4
Example (1 of 2)
Let m = 4 and n = 6 and use the Composite Simpson’s rule to
approximate the double integral:
Z π/4 Z 0
π h √ i
(2y sin x+cos2 x) dy dx = 6 + π(4 2 − 5) ≈ 0.35184
0 −π/3 72
1.0
0.5
0
z
0.0
Π
-0.5 -
12
-1.0
Π
0 - y
6
Π
24 Π
Π
12 Π -
4
x 8 Π
6
5Π
Π
24 Π -
3
4
Example (2 of 2)
Z π/4 Z 0
(2y sin x + cos2 x) dy dx ≈ 0.351846
0 −π/3
Absolute error:
π h √ i
6 + π(4 2 − 5) − 0.351846 ≈ 6.36354 × 10−6
72
Error bound:
|E(f )|
(d − c)(b − a) 4 ∂ 4 f 4
4∂ f ˆ
≤ max − h (ξ, µ) + k ( ξ, µ̂)
(ξ,µ),(ξ̂,µ̂)∈R
180 ∂x 4 ∂y 4
(π/3)(π/4) π 4
= max 8(cos2 x − sin2 x) + 2y sin x
180 24 (ξ,µ),(ξ̂,µ̂)∈R
π6
= 8 ≈ 1.07322 × 10−5
716636160
Double Integrals with Gaussian Quadrature
Absolute error:
π h √ i
6 + π(4 2 − 5) − 0.35184 ≈ 5.94305 × 10−9
72
Integrating Over Non-rectangular Regions
Consider the double integral
ZZ Z b Z d(x)
f (x, y ) dA = f (x, y ) dy dx.
R a c(x)
d(x) − c(x)
where m is an even integer and k (x) = .
m
Simplification (1 of 2)
To make the notation of the next step simpler we will make the
following change to the notation.
m/2−1
k (x) X
F (x) = f (x, c(x)) + 2 f (x, c(x) + 2jk (x))
3
j=1
m/2
X
+4 f (x, c(x) + (2j − 1)k (x)) + f (x, d(x))
j=1
Simplification (2 of 2)
This implies
Z d(x)
f (x, y ) dy
c(x)
m/2−1
k (x) X
≈ f (x, c(x)) + 2 f (x, c(x) + 2jk (x))
3
j=1
m/2
X
+4 f (x, c(x) + (2j − 1)k (x)) + f (x, d(x))
j=1
= F (x)
Simplification (2 of 2)
This implies
Z d(x)
f (x, y ) dy
c(x)
m/2−1
k (x) X
≈ f (x, c(x)) + 2 f (x, c(x) + 2jk (x))
3
j=1
m/2
X
+4 f (x, c(x) + (2j − 1)k (x)) + f (x, d(x))
j=1
= F (x)
Since we have no formula for the error term in this case we will
use the composite Simpson’s rule with n = m = 2, 4, . . . until
successive approximations differ by less than 10−4 .
n=m Estimate
2 1.03125
4 1.00195
6 1.00039
8 1.00012
10 1.00005
Gaussian Quadrature for General Regions (1 of 2)
Therefore
Z b Z d(x)
f (x, y ) dy dx
a c(x)
Z b n
(d(x) − c(x))rn,j + c(x) + d(x)
d(x) − c(x)
X
≈ cn,j f x,
a 2 2
j=1
2
z
1 6
0
1.0 4 y
1.5
2.0 2
x
2.5
Example (2 of 2)
Z e Z x2
ln(x y ) dy dx ≈ 6.36185
1 x
Absolute error:
Z Z 2
e x
ln(x y ) dy dx − 6.36185 ≈ 5.95798 × 10−6
1 x
Homework