Professional Documents
Culture Documents
www.motovasibelajar.com
LEARNING OUTCOMES
By the end of this lecture, students should be able to:
(1) Differentiate between trapezoidal rule and Simpsons rule.
(2) Summarize the formula for numerical integration.
I f ( x )dx
Integrand
I f ( x)dx f n ( x)dx
f n ( x) a0 a1 x
an 1 x n 1 an x n
I f ( x ) dx f1 ( x ) dx
1
width high
2
1
( a b) h
2
Area of trapezium
10
Trapezoidal rule:
f (a ) f (b)
I (b a )
2
h
f (a ) f (b)
2
11
divide into n
segments with equal
step size, h
xn
f ( x) dx
x0
x1
x2
f ( x) dx f ( x) dx
x0
I1 I 2
x1
xn
f ( x) dx
xn1
In
h
h
h
f ( x0 ) f ( x1 ) f ( x1 ) f ( x2 ) f ( x2 ) f ( x3 )
2
2
2
n 1
h
f ( x0 ) f ( xn ) 2 f ( xi )
2
i 1
f ( xn 1 ) f ( xn )
2
12
Trapezoidal rule: I f ( x0 ) f ( xn ) 2 f ( xi )
2
i 1
where
ba
h
n
step size
1st term/node
last term/node
number of strips/segments
13
EXAMPLE 1
Evaluate
0.8
x 2 e x dx
14
Solution:
f (a) f (b) h
Trapezoidal rule: I (b a)
f (a) f (b)
2
2
-single application of the Trapezoidal rule-
We have f ( x) x 2e x
x 0, f (0) 0
x 0.8, f (0.8) 0.8 .e 0.8 1.4243
2
0.8
h
f (a) f (b)
2
(0.8 0)
=
0 1.4243
2
0.5697
x 2 e x dx
15
EXAMPLE 2
Evaluate
0.8
x 2 e x dx
16
Solution:
0.8
x 2 e x dx
n 1
h
Trapezoidal rule: I f ( x0 ) f ( xn ) 2 f ( xi )
2
i 1
0.8
f(x0) , f(xn)
f(xi)
0.2
0.0489
0.4
0.2387
0.6
0.6560
0.8
1.4243
total
1.4243
0.9436
0.2
1.4243 (2)(0.9436)
2
0.3312
x 2 e x dx
17
EXAMPLE 3
Evaluate
30
140000
2000ln
9.8t dt
140000 2100t
18
Solution:
n 1
h
Trapezoidal rule: I f ( x0 ) f ( xn ) 2 f ( xi )
2
i 1
30
140000
2000ln
9.8t dt
140000 2100t
f(x0) , f(xn)
177.2667
19
30
f(xi)
484.7455
30
901.6740
total
1078.9407
484.7455
140000
11
2000 ln
9.8t dt 1078.9407 (2)(484.7455)
2
140000 2100t
11266.3744
19
Evaluate
2 x 2 dx
20
21
n
2
22
E
F
x=a
x=b
odd nodes
evennodes
h
f ( x0 ) f ( xn ) 4 f ( xi ) 2 f ( xi )
3
i 1,3,..
i 2,4,..
where
ba
h
n
23
EXAMPLE 1
Evaluate
0.8
x 2 e x dx
24
Solution:
0.8
x 2 e x dx
h
f ( x0 ) 4 f ( x1 ) f ( x2 )
3
ba
2
0.8
0.4
2
we have two segment within three equally spaced points
[ x0, x1 ],[ x1 , x2 ]
h
x0 0, f (0) 0
x1 0.4, f (0.4) 0.2387
x2 0.8, f (0.8) 1.4243
h
f ( x0 ) 4 f ( x1 ) f ( x2 )
3
0.4
=
0 4 0.2387 1.4243 0.3172
3
25
EXAMPLE 2
Evaluate
2.2
1.0
1 x 3 dx
26
Solution:
odd nodes
even nodes
h
Simpson's 1/3 rule:I f ( x0 ) f ( xn ) 4 f ( xi ) 2 f ( xi )
3
i 1,3,..
i 2,4,..
where h
ba
n
f(x0) , f(xn)
1.0
1.4142
1.2
1.4
1.6
1.8
2.0
2.2
3.4129
total
4.8271
f(xn even)
f(xn odd)
1.6517
1.9349
2.2574
2.6138
3
4.5487
6.9091
27
Solution (cont.):
2.2
1.0
f(x0) , f(xn)
1.0
1.4142
1.2
1.4
1.6
1.8
2.0
2.2
3.4129
total
4.8271
f(xn even)
f(xn odd)
1.6517
1.9349
2.2574
2.6138
3
4.5487
6.9091
0.2
1 x dx
4.8271 2(4.5487) 4(6.9091)
3
2.7707
3
28
EXAMPLE 3
Evaluate
5 3cos x dx
2
(a) analytically
(b) using Simpsons 1/3rd rule with n=4
(c) Hence, calculate the true error, t.
[x is in radians]
29
Solution:
(a) analytically
5 3cos x dx 5 x 3sin x 0
30
Solution:
(b) using Simpsons 1/3rd rule with n=4
i
f(x0) , f(xn)
0.5
1.0
1.5
2.0
3.7516
total
11.7516
ba 20
h
0.5
n
4
f(xn even)
f(xn odd)
7.6327
6.6209
5.2122
6.6209
12.8449
0.5
0 5 3cos x dx 3 11.7516 2 6.6209 4 12.8449
12.7288
2
31
Solution:
(c) Hence, calculate the true error, t.
100
12.7279
0.0071%
32
140000
x 2000 ln
9
.
8
t
dt
140000 2100t
8
30
Use Simpsons 1/3rd rule to find the approximate value of x with n=4.
Answer: 11061.64
33
3h
I f ( x0 ) 3 f ( x1 ) 3 f ( x2 ) f ( x3 )
8
ba
where h
3
34
EXAMPLE 1
Evaluate
0.7
0.4
x 2 e x dx
35
Solution:
b a 0.7 0.4
0.1
3
3
we have three segments within four equally spaced points
[ x0, x1 ],[ x1 , x2 ],[ x2 , x3 ]
h
36
EXAMPLE 2
Evaluate
0.7
x 2 e x dx
37
Solution:
ba
b a 0.7 0
h
n
7
n
h
0.1
Simpsons 3/8 rule n = 3
Simpsons 1/3rd rule n even
0.7
x e dx
2
0.4
x e dx
0
use composite simpson's 1/3rd rule-
0.7
x 2e x dx
0.4
use simpson's 3/8 rule-
38
EXAMPLE 3
Evaluate
x2
e( x 1) dx
sin x
39
CONCLUSION
INTEGRATION
TRAPEZOIDAL
RULE
SINGLE
h
I f (a) f (b)
2
where h b a
I
SIMPSONS 1/3RD
RULE
SIMPSONS 3/8
RULE
h
f ( x0 ) 4 f ( x1 ) f ( x2 )
3
where h
ba
2
COMPOSITE
n 1
h
I f ( x0 ) f ( xn ) 2 f ( xi )
2
i 1
where h
ba
n
I f ( x0 ) f ( xn ) 4 f ( x1 ) ... f ( xn 1 ) 2 f ( x2 ) ... f ( xn 2 )
3
odd term
even term
ba
where h
n
3h
f ( x0 ) 3 f ( x1 ) 3 f ( x2 ) f ( x3 )
8
where h
ba
3
40