Professional Documents
Culture Documents
Qiao Zhonghua
• Overview
• Newton-Cotes Formulas
• Romberg Method
.
HONG KONG BAPTIST UNIVERSITY 4
The methods of quadrature in this section are based on the
interpolation polynomials given in Chapter 3. We first select a set of
distinct nodes x0, . . . , xn from the interval [a, b]. Then we integrate
the Lagrange interpolating polynomial
n
X
Pn(x) = f (xi)Li(x)
i=0
b n
Z bX n
Z bY
f (n+1)(ξ(x))
Z
f (x)dx = f (xi)Li(x)dx + (x − xi) dx
a a i=0 a i=0
(n + 1)!
Z b
ai = Li(x)dx. for each i = 0, 1, . . . , n.
a
Z b n
X
f (x)dx ≈ aif (xi),
a i=0
(x − x1) (x − x0)
P (x) = f (x0) + f (x1)
(x0 − x1) (x1 − x0)
Example 1
Consider:
Z 2
ln x
dx
1 x
• (c)Find a bound for the error contained in the solution to Part (b)
b
h3 00
Z
1
| f (x)dx − [f (a) + f (b)]| = |f (ξ)| a < ξ < b.
a 2 12
ln x 0 1 − ln x
f (x) = , f (x) = 2
.
x x
HONG KONG BAPTIST UNIVERSITY 10
00 2 ln x − 3 1
f (x) = (ln x ↑ but ↓ with xincreasing).
x3 x3
000 11 − 6 ln x
f (x) = letf 000(x) = 0 ⇒ x ≈ 0.25470∈
¯ (1, 2).
x4
f 000(1) = 11 > 0, f 000(2) ≈ 0.427570 > 0
h3 00 f (4)(ξ1) 5
= 2hf (x1) + f (x1) + h dx.
3 60
00 1 h2 (4)
f (x1) = 2 [f (x0) − 2f (x1) + f (x2)] − f (ξ2).
h 12
b
h5 (4)
Z
h
f (x)dx = [f (x0) + 4f (x1) + f (x2)] − f (ξ).
a 3 90
The results to three places for some elementary functions are summarized in Table
4.7. Notice that in each instance Simpson’s Rule is significantly
√ better.
1
f (x) x2 x4 (x+1) 1 + x2 sin x ex
Exact value 2.667 6.400 1.099 2.958 1.416 6.389
Table 4.7
Trapezoidal 4.000 16.000 1.333 3.326 0.909 8.389
Simpson’s 2.667 6.667 1.111 2.964 1.425 6.421
Z b n
X
f (x)dx ≈ aif (xi)
a i=0
xn xn n
(x − xj )
Z Z Y
ai = Li(x)dx = dx
x0 x0 (xi − xj )
j=0,j6=i
Z b n n+3 (n+2) Z n
X h f (ξ)
f (x)dx = aif (xi) + t2(t − 1) · · · (t − n)dt.
a i=0
(n + 2)! 0
b n n
hn+2f (n+1)(ξ)
Z X Z
f (x)dx = aif (xi) + t(t − 1) · · · (t − n)dt.
a i=0
(n + 1)! 0
• n=4:
Z x4
2h 8h7 (6)
f (x)dx = [7f (x0)+32f (x1)+12f (x2)+32f (x3)+7f (x4)]− f (ξ)
x0 45 945
• n=2: x3
14h5 (4)
Z
4h
f (x)dx = [2f (x0) − f (x1) + 2f (x2)] + f (ξ)
x−1 3 45
• n=3:
x4
95h5 (4)
Z
5h
f (x)dx = [11f (x0) + f (x1) + f (x2) + 11f (x3)] + f (ξ)
x−1 24 144
Table 4.8
n 0 1 2 3 4
Closed formulas 0.27768018 0.29293264 0.29291070 0.29289318
Error 0.01521303 0.00003942 0.00001748 0.00000004
Open formulas 0.30055887 0.29798754 0.29285866 0.29286923
Error 0.00766565 0.00509432 0.00003456 0.00002399
b (n/2)−1 n/2
b − a 4 (4)
Z
h X X
f (x)dx = f (a) + 2 f (x2j ) + 4 f (x2j−1) + f (b)− h f (µ).
a 3 j=1 j=1
180
Example 4. R2 1
Determine the value of n and h required to approximate 0 x+4 dx to within 10−5
if using:
• (a) Composite Trapezoidal rule; From Theorem 4.5, the error term:
−1 2
f 0(x) = 2
, f 00(x) =
(x + 4) (x + 4)3
2 1
max f 00(µ) = =
0≤µ≤2 (0 + 4)3 32
Therefore
h2
b − a 2 00 1 1 2
−
12 h f (µ) = ( )h =
max 12 32 192
Let
h2
< 10−5 = ∆ h < 0.0438178.
192
b−a
Since h = n = n2 , let 2
n < 0.0438178 ⇒ n > 45.6435. Take n = 46.
4
000 −6 α
f (x) = , f (4)(α) =
(x + 4)4 (x + 4)5
24 3
max f (4)(µ) = =
0≤µ≤2 (0 + 4)5 128
Therefore 4
b − a 4 (4) 2 3 4 h
−
180 h 2f (µ) ax = 180 ( 128 )h = 3840 .
m
Let
h4
< 10−5 = ∆ h < 0.0442673.
3840
Since h = b−a
n = 2
n , let 2
n < 0.0442673 ⇒ n > 4.51801 n should be an even
number. So,take n = 6.
h1 (b − a)
R1,1 = [f (a) + f (b)] = [f (a) + f (b)]
2 2
h2
R2,1 = [f (a) + f (b) + 2f (a + h2)]
2
HONG KONG BAPTIST UNIVERSITY 26
(b − a) b−a
= f (a) + f (b) + 2f a +
4 2
1
= [R1,1 + h1f (a + h2)]
2
1
R3,1 = [R2,1 + h2f (a + h3) + f (a + 3h3)]
2
and in general
k−2
2
1 X
Rk,1 = Rk−1,1 + hk−1 f (a + (2i − 1)hk )
2 i=1
Suppose f ∈ C ∞[a, b], then the Composite Trapezoidal rule has the form
Z b ∞
X ∞
X
f (x)dx − Rk,1 = Kih2i
k = K 1 h 2
k+ Kih2i
k
a i=1 i=2
b ∞ ∞ ∞
Kih2i K1h2k X Kih2i
Z X X
f (x)dx − Rk+1,1 = Kih2i
k+1 =
k
= + k
a i=1 i=2
22i 4 i=2
4i
b ∞
Ki h2i
Rk+1,1 − Rk,1
Z X
k 2i
f (x)dx − Rk+1,1 + = i−1
− h k
a 3 i=2
3 4
∞ i−1
X Ki 1 − 4 2i
= i−1
h k
i=2
3 4
or
∞ i−1
K2 4 X Ki 1 − 4
intbaf (x)dx − Rk+1,2 = − hk + h2i
k
4 i=3
3 4i−1
Rk,j−1 − Rk−1,j−1
Rk,j = Rk,j−1 +
4j−1 − 1
j = 2, 3, · · · , n, k = j, j + 1, · · · , n.
R1,1
R2,1 R2,2
R3,1 R3,2 R3,3
R4,1 R4,2 R4,3 R4,4
.. .. .. .. ...
Rn,1 Rn,2 Rn,3 Rn,4 ··· Rn,n
Example 5.
st
R π2
Run the 1 step of the Romberg integration scheme to approximate − π cos xdx
2
up to k = 4.
Soln:
b−a
k = 1, n = 2k−1 = 1, hk−1 does not exist, h k = h1 = π =
n
HONG KONG BAPTIST UNIVERSITY 30
b−a π
R1,1 = [f (a) + f (b)] = [cos(−π/2) + cos(π/2)] = 0
2 2
π
k = 2, n = 2, hk−1 = h1 = π, hk = h2 =
2
1
1 X 1
R2,1 = [R1,1 + h1 f (a + (2i − 1)h2)] = [R1,1 + πf (a + h2)]
2 i=1
2
1
= [R1,1 + π cos(0)] = 1.57080
2
π π
k = 3, n = 4, hk−1 = h2 = , h k = h3 =
2 4
1
1 π X
R3,1 = [R2,1 + ( ) f (a + (2i − 1)h3)]
2 2 i=1
π π
k = 4, n = 8, hk−1 = h3 = , h k = h4 =
4 8
1 π −3π −π π 3π
R3,1 = [R3,1 + ( ) cos( ) + cos( ) + cos( ) + cos( ) ]
2 2 8 8 8 8
= 1.97423