Professional Documents
Culture Documents
HCMC — 2019.
1 PROBLEMS
1 PROBLEMS
2 TRAPEZOIDAL RULE
1 PROBLEMS
2 TRAPEZOIDAL RULE
3 SIMPSON’S RULE
PROBLEMS
PROBLEMS
1 + x 3 d x.
−1
PROBLEMS
1 + x 3 d x.
−1
2
The function is determined from a scientific
experiment through instrument readings or
collected data. There may be no formula for the
function.
(HCMUT) APPROXIMATE INTEGRATION HCMC — 2019. 3 / 34
Trapezoidal Rule Riemann sum
RIEMANN SUM
TRAPEZOIDAL RULE
Let y k = f (x k ), k = 0, 1, . . . , n
hh i
The k − t h trapezoid has area f (x k−1 ) + f (x k ) .
2
TRAPEZOIDAL RULE
Let y k = f (x k ), k = 0, 1, . . . , n
hh i
The k − t h trapezoid has area f (x k−1 ) + f (x k ) .
2
y0 + y1 y1 + y2 y n−1 + y n
≈ Tn = h · +h · +...+h ·
2 2 2
h n−1
X h³ ´
Tn = (y k + y k+1 ) = y 0 + 2y 1 + 2y 2 + . . . + 2y n−1 + y n
2 k=0 2
(5)
ERROR BOUNDS
DEFINITION 2.1
The error in using an approximation is defined to be
the amount that needs to be added to the
approximation to make it exact.
Z b
f (x)d x = appr oxi mat i on + er r or (6)
a
ERROR BOUNDS
DEFINITION 2.1
The error in using an approximation is defined to be
the amount that needs to be added to the
approximation to make it exact.
Z b
f (x)d x = appr oxi mat i on + er r or (6)
a
In general, we have
Z b Z b
ET = f (x)d x − Tn , EM = f (x)d x − M n
a a
(HCMUT) APPROXIMATE INTEGRATION HCMC — 2019. 10 / 34
Trapezoidal Rule Error Bounds
THEOREM 2.1
Suppose | f 00 (x)| É K , for a É x É b. If E T and E M are the
errors in the Trapezoidal and Midpoint Rules, then
K (b − a)3 K (b − a)3
|E T | É , |E M | É (7)
12n 2 24n 2
EXAMPLE 2.1
Use the Trapezoidal Rule and Left endpoint, Right
endpoint, Midpoint Rules with n = 5 to approximate
2
dx
Z
the integral ·
1 x
EXAMPLE 2.1
Use the Trapezoidal Rule and Left endpoint, Right
endpoint, Midpoint Rules with n = 5 to approximate
2
dx
Z
the integral ·
1 x
SOLUTION.
2−1 1 k 1 5
h= = , x 0 = 1, x k = 1 + , y k = f (x k ) = =
5 5 5 1 + k5 5 + k
h P
µ ¶
4 1 P4 5 5
I≈ (y k + y k+1 ) = +
2 k=0 10 k=0 5 + k 5 + (k + 1)
≈ 0.695635
h³ ´
I≈ y 0 + 2y 1 + 2y 2 + 2y 3 + 2y 4 + y 5
2
CASIO.
0.2
A = A+ × B × (1 ÷ X ) : X = X + 0.2
2
CALC A=0, X=1, B=1=.
A=, X=, B=2=.
...,...,...
A=, X=2, B=1=.
Answer: I ≈ 0.695635
MIDPOINT
h ³x + x ´ ³x + x ´ ³x + x ´
0 1 1 2 2 3
I ≈h f +f +f +
2 2 2
³x + x ´ ³x + x ´i
3 4 4 5
+f +f
2 2
CASIO.
A = A + 0.2 × (1 ÷ X ) : X = X + 0.2
CALC A=0, X=1.1.
A=, X=.
...,...,...
A=, X=1.9.
Answer: I ≈ 0.691908
(HCMUT) APPROXIMATE INTEGRATION HCMC — 2019. 14 / 34
Trapezoidal Rule Error Bounds
LEFT ENDPOINT
h i
I ≈ h f (x 0 ) + f (x 1 ) + f (x 2 ) + f (x 3 ) + f (x 4 )
CASIO.
A = A + 0.2 × (1 ÷ X ) : X = X + 0.2
RIGHT ENDPOINT
h i
I ≈ h f (x 1 ) + f (x 2 ) + f (x 3 ) + f (x 4 ) + f (x 5 )
CASIO.
A = A + 0.2 × (1 ÷ X ) : X = X + 0.2
2
dx
Z
Approximations to
1 x
n Ln Rn Tn Mn
5 0.745635 0.645635 0.695635 0.691908
10 0.718771 0.668771 0.693771 0.692835
20 0.705803 0.680803 0.693303 0.693069
2
dx
Z ¯2
The exact value = ln x ¯ = ln 2.
¯
1 x 1
Corresponding errors
n EL ER ET EM
5 -0.052488 0.047512 -0.002488 0.001239
10 -0.025624 0.024376 -0.000624 0.000312
20 -0.012656 0.012344 -0.000156 0.000078
(HCMUT) APPROXIMATE INTEGRATION HCMC — 2019. 17 / 34
Trapezoidal Rule Error Bounds
EXAMPLE 2.2
UseZthe trapezoidal rule with n = 10 to estimate
1
dx
I= ·
0 1+x
EXAMPLE 2.2
UseZthe trapezoidal rule with n = 10 to estimate
1
dx
I= ·
0 1+x
SOLUTION.
b −a 1−0 1 k
h= = = , x 0 = 0, x k = ,
n 10 10 10
1 10
y k = f (x k ) = =
k 10 + k
1+
10
h P
µ ¶
9 1 P9 10 10
I≈ (y k + y k+1 ) = +
2 k=0 20 k=0 10 + k 10 + (k + 1)
≈ 0.6938
(HCMUT) APPROXIMATE INTEGRATION HCMC — 2019. 18 / 34
Trapezoidal Rule Error Bounds
I≈
h³ ´
y 0 +2y 1 +2y 2 +2y 3 +2y 4 +2y 5 +2y 6 +2y 7 +2y 8 +2y 9 + y 10
2
CASIO.
0.1
A = A+ × B × (1 ÷ (1 + X )) : X = X + 0.1
2
CALC A=0, X=0, B=1=.
A=, X=, B=2=.
...,...,...
A=, X=1, B=1=.
Answer: I ≈ 0.6938
EXAMPLE 2.3
How large should we take n in order to guarantee that
the ZTrapezoidal and Midpoint Rule Approximations
2
dx
for are accurate to within 0.0001?
1 x
EXAMPLE 2.3
How large should we take n in order to guarantee that
the ZTrapezoidal and Midpoint Rule Approximations
2
dx
for are accurate to within 0.0001?
1 x
2
SOLUTION. f 00 (x) = 3 . So
x
2(2 − 1)3
¯ ¯
¯2¯
| f 00 (x)| = ¯¯ 3 ¯¯ É 2, ∀x ∈ [1, 2] ⇒ |E T | É < 0.0001
x 12n 2
1
⇒n> p ≈ 40.8 ⇒ n = 41.
0.0006
EXAMPLE 2.3
How large should we take n in order to guarantee that
the ZTrapezoidal and Midpoint Rule Approximations
2
dx
for are accurate to within 0.0001?
1 x
2
SOLUTION. f 00 (x) = 3 . So
x
2(2 − 1)3
¯ ¯
¯2¯
| f 00 (x)| = ¯¯ 3 ¯¯ É 2, ∀x ∈ [1, 2] ⇒ |E T | É < 0.0001
x 12n 2
1
⇒n> p ≈ 40.8 ⇒ n = 41.
0.0006
2(2 − 1)3 1
|E M | É < 0.0001 ⇒ n > p ≈ 28.86 ⇒ n = 29.
24n 2 0.0012
(HCMUT) APPROXIMATE INTEGRATION HCMC — 2019. 20 / 34
Trapezoidal Rule Error Bounds
EXAMPLE 2.4
If the function f (x) is defined by table
x 1.0 1.2 1.4 1.6 1.8 2.0 2.2
then using
f (x) 4 3.3 2.4 4.3 10.2 6.2 7.4
the ZTrapezoidal Rule to approximate the integral
2.2 ³ ´
2 3
I= x f (x) + 4.4x d x
1.0
EXAMPLE 2.4
If the function f (x) is defined by table
x 1.0 1.2 1.4 1.6 1.8 2.0 2.2
then using
f (x) 4 3.3 2.4 4.3 10.2 6.2 7.4
the ZTrapezoidal Rule to approximate the integral
2.2 ³ ´
2 3
I= x f (x) + 4.4x d x
1.0
b − a 2.2 − 1.0
h= = = 0.2 ⇒ n = 6,
n n
x 0 = 1.0, x k = 1.0 + 0.2k, y k = x k f 2 (x k ) + 4.4x k3 .
Therefore
h P5 h
I≈ (y k + y k+1 ) = (y 0 +2y 1 +2y 2 +2y 3 +2y 4 +2y 5 + y 6 ).
2 k=0 2
CASIO h = 0.2, we have
h
A = A+ × B × (X Y 2 + 4.4X 3 ) : X = X + h
2
X 1.0 1.2 1.4 1.6 1.8 2.0 2.2
Y 4 3.3 2.4 4.3 10.2 6.2 7.4
B 1 2 2 2 2 2 1
CALC A=0, X=1.0, Y=4, B=1=.
CALC A=, X=, Y=3.3, B=2=.
...,...,...
CALC A=, X=2.2, Y=7.4, B=1=.
Answer. I ≈ 101.4579
(HCMUT) APPROXIMATE INTEGRATION HCMC — 2019. 22 / 34
Simpson’s Rule
SIMPSON’S RULE
Another rule for approximate integration results
from using parabolas instead of straight line
segments to approximate a curve.
SIMPSON’S RULE
Another rule for approximate integration results
from using parabolas instead of straight line
segments to approximate a curve.
Suppose the interval [a, b] is partitioned into 2n
b−a
equal parts, each of width ∆x = h = by the
2n
subdivision points a = x 0 , x 1 = x 0 + h, . . . ,
x k = x 0 + kh, . . . , x 2n = b. Let y k = f (x k ), k = 0, 1, . . . , 2n
Z h Z h
2
(At + B t +C )d t = 2 (At 2 +C )d t
−h 0
¸h
t3 h
·
= 2 A +C t = (2Ah 2 + 6C )
3 0 3
Z h Z h
2
(At + B t +C )d t = 2 (At 2 +C )d t
−h 0
¸h
t3 h
·
= 2 A +C t (2Ah 2 + 6C )
=
3 0 3
But, since the parabola passes through P 0 (x 0 , y 0 ),
P 1 (x 1 , y 1 ), and P 2 (x 2 , y 2 ), we have
y 0 = A(−h)2 + B (−h) +C = Ah 2 − Bh +C
y1 = C
y 2 = Ah 2 + Bh +C
and therefore y 0 + 4y 1 + y 2 = 2Ah 2 + 6C . Thus the area
h
under the parabola is (y 0 + 4y 1 + y 2 ).
3
(HCMUT) APPROXIMATE INTEGRATION HCMC — 2019. 25 / 34
Simpson’s Rule
h h h
≈ (y 0 +4y 1 +y 2 )+ (y 2 +4y 3 +y 4 )+..+ (y 2n−2 +4y 2n−1 +y 2n )
3 3 3
h n−1
X
I≈ (y 2k + 4y 2k+1 + y 2k+2 ) (8)
3 k=0
h³ ´
= y 0 + 4y 1 + 2y 2 + 4y 3 + 2y 4 + . . . + 2y 2n−2 + 4y 2n−1 + y 2n
3
(HCMUT) APPROXIMATE INTEGRATION HCMC — 2019. 26 / 34
Simpson’s Rule
ERROR BOUNDS
THEOREM 3.1
Suppose | f (4) (x)| É K , for a É x É b. If E S is the error
involved in using Simpson’s Rule, then
K (b − a)5
|E S | É (9)
2880n 4
EXAMPLE 3.1
UseZSimpson’s rule with 2n = 20 to approximate
1
dx
I= and estimate the error involved in this
0 1+x
approximation.
EXAMPLE 3.1
UseZSimpson’s rule with 2n = 20 to approximate
1
dx
I= and estimate the error involved in this
0 1+x
approximation.
SOLUTION.
b −a 1−0 1 k
h= = = , x 0 = 0, x k = ,
2n 20 20 20
1 20
y k = f (x k ) = k
= ·
1 + 20 20 + k
Therefore
h n−1
X
I≈ (y 2k + 4y 2k+1 + y 2k+2 ) =
3 k=0
9 µ ¶
1 X 20 20 20
= +4 + ≈ 0.6931
60 k=0 20 + 2k 2k + 21 2k + 22
Therefore
h n−1
X
I≈ (y 2k + 4y 2k+1 + y 2k+2 ) =
3 k=0
9 µ ¶
1 X 20 20 20
= +4 + ≈ 0.6931
60 k=0 20 + 2k 2k + 21 2k + 22
h³
I≈ y 0 +4y 1 +2y 2 +4y 3 +2y 4 +4y 5 +2y 6 +4y 7 +2y 8 +4y 9 +2y 10 +
3
´
+4y 11 +2y 12 +4y 13 +2y 14 +4y 15 +2y 16 +4y 17 +2y 18 +4y 19 +y 20
CASIO.
B 1 1
A = A+ × :X =X+
6 × 10 X + 1 2 × 10
CALC A=0, B=1, X=0;
A=, B=4;X=;
A=, B=2;X=;
A=, B=4;X=;
A=, B=2;X=;
......
A=, B=1;X=1;
Answer. I ≈ 0.6931
1 4!
The fourth derivative of f (x) = is f (4) (x) =
1+x (1 + x)4
⇒ | f (4) (x)| É 4!, ∀x ∈ [0, 1].
EXAMPLE 3.2
Suppose the function f (x) is defined by table
x | 1.0 1.2 1.4 1.6 1.8 2.0 2.2
. Using
f (x) | 2 3.3 2.4 4.3 5.1 6.2 7.4
Simpson’s rule to approximate the integral
Z 2.2 h i
I= x f 2 (x) + 2.2x 3 d x .
1.0
EXAMPLE 3.2
Suppose the function f (x) is defined by table
x | 1.0 1.2 1.4 1.6 1.8 2.0 2.2
. Using
f (x) | 2 3.3 2.4 4.3 5.1 6.2 7.4
Simpson’s rule to approximate the integral
Z 2.2 h i
I= x f 2 (x) + 2.2x 3 d x .
1.0
b − a 2.2 − 1.0
h= = = 0.2 ⇒ 2n = 6,
2n 2n
x 0 = 1.0, x k = 1.0 + 0.2k.
y k = x k f 2 (x k ) + 2.2x k3 .
0.2
I≈ (y 0 + 4y 1 + 2y 2 + 4y 3 + 2y 4 + 4y 5 + y 6 )
3
CASIO.
0.2
A = A +B ∗ ∗ (X Y 2 + 2.2X 3 ) : X = X + 0.2
3
CALC A=0, B, X, Y is given by table
X | 1.0 1.2 1.4 1.6 1.8 2.0 2.2
Y | 2 3.3 2.4 4.3 5.1 6.2 7.4
B | 1 4 2 4 2 4 1