ee3561_unit 7al-dhaifallah1435 1 ee 3561 : computational methods unit 7 numerical integration dr....
TRANSCRIPT
EE3561_Unit 7 Al-Dhaifallah14351
EE 3561 : Computational MethodsUnit 7
Numerical Integration
Dr. Mujahed AlDhaifallah
( Term 342)
EE3561_Unit 7 Al-Dhaifallah1435 2
Lecture 19 Introduction to
Numerical Integration Definitions Upper and Lower Sums Trapezoid Method Examples
EE3561_Unit 7 Al-Dhaifallah1435 3
IntegrationIntegration
Indefinite Integrals
Indefinite Integrals of a function are functions that differ from each other by a constant.
cx
dxx2
2
Definite Integrals
Definite Integrals are numbers.
2
1
2
1
0
1
0
2
x
xdx
EE3561_Unit 7 Al-Dhaifallah1435 4
Fundamental Theorem of Fundamental Theorem of CalculusCalculus
for solution form closedNo
for tiveantideriva no is There
) f(x)(x) ' F(i.e. f of tiveantideriva is
, interval an on continuous is If
2
2
b
a
x
x
b
a
dxe
e
F(a)F(b)f(x)dx
F
[a,b]f
EE3561_Unit 7 Al-Dhaifallah1435 5
The Area Under the The Area Under the CurveCurve
b
af(x)dxArea
One interpretation of the definite integral is
Integral = area under the curve
a b
f(x)
EE3561_Unit 7 Al-Dhaifallah1435 6
Riemann Sums
EE3561_Unit 7 Al-Dhaifallah1435 7
Numerical Integration Methods
Numerical integration Methods Covered in this course
Upper and Lower Sums
Newton-Cotes Methods:
Trapezoid Rule
Romberg Method
EE3561_Unit 7 Al-Dhaifallah1435 8
Upper and Lower SumsUpper and Lower Sums
a b
f(x)
3210 xxxx
ii
n
ii
ii
n
ii
iii
iii
n
xxMPfUsumUpper
xxmPfLsumLower
xxxxfM
xxxxfm
Define
bxxxxaPPartition
1
1
0
1
1
0
1
1
210
),(
),(
:)(max
:)(min
...
The interval is divided into subintervals
EE3561_Unit 7 Al-Dhaifallah1435 9
Upper and Lower SumsUpper and Lower Sums
a b
f(x)
3210 xxxx
2
2 integral theof Estimate
),(
),(
1
1
0
1
1
0
LUError
UL
xxMPfUsumUpper
xxmPfLsumLower
ii
n
ii
ii
n
ii
EE3561_Unit 7 Al-Dhaifallah1435 10
ExampleExample
14
3
2
1
4
10
3,2,1,04
1
1,16
9,
4
1,
16
116
9,
4
1,
16
1,0
)intervals equalfour (4
1,4
3,
4
2,
4
1,0
1
3210
3210
1
0
2
iforxx
MMMM
mmmm
n
PPartition
dxx
ii
EE3561_Unit 7 Al-Dhaifallah1435 11
ExampleExample
14
3
2
1
4
10
8
1
64
14
64
30
2
1
32
11
64
14
64
30
2
1integraltheofEstimate
64
301
16
9
4
1
16
1
4
1),(
),(
64
14
16
9
4
1
16
10
4
1),(
),(
1
1
0
1
1
0
Error
PfU
xxMPfUsumUpper
PfL
xxmPfLsumLower
ii
n
ii
ii
n
ii
EE3561_Unit 7 Al-Dhaifallah1435 12
Upper and Lower SumsUpper and Lower Sums• Estimates based on Upper and Lower
Sums are easy to obtain for monotonic functions (always increasing or always decreasing).
• For non-monotonic functions, finding maximum and minimum of the function can be difficult and other methods can be more attractive.
EE3561_Unit 7 Al-Dhaifallah1435 13
Newton-Cotes Methods In Newton-Cote Methods, the function
is approximated by a polynomial of order n
Computing the integral of a polynomial is easy.
1
)(...
2
)()()(
...)(
1122
10
10
n
aba
abaabadxxf
dxxaxaadxxf
nn
n
b
a
b
a
nn
b
a
EE3561_Unit 7 Al-Dhaifallah1435 14
Newton-Cotes Methods Trapezoid Method (First Order Polynomial are used)
Simpson 1/3 Rule (Second Order Polynomial are used),
b
a
b
a
b
a
b
a
dxxaxaadxxf
dxxaadxxf
2210
10
)(
)(
EE3561_Unit 7 Al-Dhaifallah1435 15
Trapezoid MethodTrapezoid Method
)()()(
)( axab
afbfaf
f(x)
ba 2
)()(
2
)()(
)()()(
)()()(
)(
)(
2
afbfab
x
ab
afbf
xab
afbfaaf
dxaxab
afbfafI
dxxfI
b
a
b
a
b
a
b
a
EE3561_Unit 7 Al-Dhaifallah1435 16
Trapezoid MethodDerivation-One interval
2
)()(
)()(2
)()()()()(
2
)()()()()(
)()()()()(
)()()(
)()(
22
2
afbfab
abab
afbfab
ab
afbfaaf
x
ab
afbfx
ab
afbfaaf
dxxab
afbf
ab
afbfaafI
dxaxab
afbfafdxxfI
b
a
b
a
b
a
b
a
b
a
EE3561_Unit 7 Al-Dhaifallah1435 17
Trapezoid MethodTrapezoid Method
)(bf
f(x)
ba
)()(2
bfafab
Area
)(af
EE3561_Unit 7 Al-Dhaifallah1435 18
Trapezoid MethodTrapezoid MethodMultiple Application RuleMultiple Application Rule
a b
f(x)
3210 xxxx
s trapezoid theof
areas theof sum)(
...
segments into dpartitione
is b][a, intervalThe
210
b
a
n
dxxf
bxxxxa
n
1212
2
)()(xx
xfxfArea
x
EE3561_Unit 7 Al-Dhaifallah1435 19
Trapezoid MethodTrapezoid MethodGeneral Formula and special caseGeneral Formula and special case
)()(2
1)(
...
equal)y necessarilot segments(nn into divided is interval theIf
11
1
0
210
iiii
n
i
b
a
n
xfxfxxdxxf
bxxxxa
1
10
1
)()()(2
1)(
allfor
points) base spacedEqualiy ( CaseSpecial
n
iin
b
a
ii
xfxfxfhdxxf
ihxx
EE3561_Unit 7 Al-Dhaifallah1435 20
Example
Given a tabulated values of the velocity of an object.
Obtain an estimate of the distance traveled in the interval [0,3].
Time (s) 0.0 1.0 2.0 3.0
Velocity (m/s) 0.0 10 12 14
Distance = integral of the velocity
3
0)(Distance dttV
EE3561_Unit 7 Al-Dhaifallah1435 21
ExampleExampleTime (s) 0.0 1.0 2.0 3.0
Velocity (m/s)
0.0 10 12 14
29)140(2
112)(101 Distance
)()(2
1)(
1
0
1
1
1
n
n
ii
ii
xfxfxfhT
xxh
MethodTrapezoid
3,2,1,0are points Base
lssubinterva3 into
divided is interval The
EE3561_Unit 7 Al-Dhaifallah1435 22
Estimating the Error Estimating the Error For Trapezoid methodFor Trapezoid method
?accurcy digit decimal 5 to
)sin( compute toneeded
are intervals spacedequally many How
0
dxx
EE3561_Unit 7 Al-Dhaifallah1435 23
Error in estimating the Error in estimating the integralintegralTheoremTheorem
a
3
[ , ]
3
Assumption: ''( ) is continuous on
Equal intervals (width )
Theorem: If Trapezoid Method is used to
approximate ( ) then
max ''( ) (One Interval Case)12
12
b
x a b
f x [a,b]
h
f x dx
b aError f x
b aError
n
2 [ , ]max ''( ) (Multiple Application Case)x a b
f x
EE3561_Unit 7 Al-Dhaifallah1435 24
ExampleExample
5
0
3
2 [ , ]
35
2
25 3
2
1sin( ) , error 10
2
max ''( )12
; 0; '( ) cos( ); ''( ) sin( )
1''( ) 1 10
12 2
610 4.3701 10
x a b
x dx find h so that
b aError f x
nb a f x x f x x
f x Errorn
hn
EE3561_Unit 7 Al-Dhaifallah1435 25
ExampleExample
)()(2
1)(),(
, allfor :
)()(2
1),(
)(Compute tomethod TrapezoidUse
0
1
1
1
11
1
0
3
1
n
n
ii
ii
iiii
n
i
xfxfxfhPfT
ixxhCaseSpecial
xfxfxxPfTTrapezoid
dxxf
x 1.0 1.5 2.0 2.5 3.0
f(x) 2.1 3.2 3.4 2.8 2.7
EE3561_Unit 7 Al-Dhaifallah1435 26
ExampleExample
9.5
7.21.22
18.24.32.35.0
)()(2
1)()( 0
1
1
3
1
n
n
ii xfxfxfhdxxf
x 1.0 1.5 2.0 2.5 3.0
f(x) 2.1 3.2 3.4 2.8 2.7
EE3561_Unit 7 Al-Dhaifallah1435 27
Lecture 21 Romberg Method
MotivationDerivation of Romberg MethodRomberg MethodExampleWhen to stop?
EE3561_Unit 7 Al-Dhaifallah1435 28
Motivation for Romberg Motivation for Romberg MethodMethod Trapezoid formula with an interval h gives
error of the order O(h2) We can combine two Trapezoid estimates
with intervals h and h/2 to get a better estimate.
EE3561_Unit 7 Al-Dhaifallah1435 29
Romberg MethodRomberg Method
First column is obtained using Trapezoid Method
dx f(x) ofion approximat theimprove tocombined are
,...8
a-b,
4
a-b ,
2
a-b
,a-b size of intervals with method Trapezoid using Estimates
b
aR(0,0)
R(1,0) R(1,1)
R(2,0) R(2,1) R(2,2)
R(3,0) R(3,1) R(3,2) R(3,3)The other elements are obtained using the Romberg Method
EE3561_Unit 7 Al-Dhaifallah1435 30
First Column First Column Recursive Trapezoid Recursive Trapezoid MethodMethod
f(x)
haa
)()(2
)0,0(R
intervaloneonbasedEstimate
bfafab
abh
EE3561_Unit 7 Al-Dhaifallah1435 31
Recursive Trapezoid Recursive Trapezoid MethodMethod
f(x)
hahaa 2
)()0,0(2
1)0,1(
)()(2
1)(
2)0,1(R
2
intervals 2 on based Estimate
hafhRR
bfafhafab
abh
Based on previous estimate
Based on new point
EE3561_Unit 7 Al-Dhaifallah1435 32
Recursive Trapezoid Recursive Trapezoid MethodMethod
f(x)
)3()()0,1(2
1)0,2(
)()(2
1
)3()2()(4
)0,2(R
4
hafhafhRR
bfaf
hafhafhafab
abh
hahaa 42 Based on previous estimate
Based on new points
EE3561_Unit 7 Al-Dhaifallah1435 33
Recursive Trapezoid Recursive Trapezoid MethodMethodFormulasFormulas
n
k
abh
hkafhnRnR
bfafab
n
2
)12()0,1(2
1)0,(
)()(2
)0,0(R
)1(2
1
EE3561_Unit 7 Al-Dhaifallah1435 34
Recursive Trapezoid Recursive Trapezoid MethodMethod
)1(
2
2
1
2
13
2
12
1
1
)12()0,1(2
1)0,(,
2
..................
)12()0,2(2
1)0,3(,
2
)12()0,1(2
1)0,2(,
2
)12()0,0(2
1)0,1(,
2
)()(2
)0,0(R,
n
kn
k
k
k
hkafhnRnRab
h
hkafhRRab
h
hkafhRRab
h
hkafhRRab
h
bfafab
abh
EE3561_Unit 7 Al-Dhaifallah1435 35
Derivation of Romberg Derivation of Romberg MethodMethod
...)0,1()0,(3
1)0,()(
2*41
)2(...64
1
16
1
4
1)0,()(
by R(n,0) obtained is estimate accurate More
)1(...)0,1()(
2 method Trapezoid)()0,1()(
66
44
66
44
22
66
44
22
12
hbhbnRnRnRdxxf
giveseqeq
eqhahahanRdxxf
eqhahahanRdxxf
abhwithhOnRdxxf
b
a
b
a
b
a
n
b
a
EE3561_Unit 7 Al-Dhaifallah1435 36
Romberg MethodRomberg Method
1,1
)1,1()1,(14
1)1,(),(
)12()0,1(2
1)0,(
,2
)()(2
)0,0(R
)1(2
1
mnfor
mnRmnRmnRmnR
hkafhnRnR
abh
bfafab
m
k
n
n
R(0,0)
R(1,0) R(1,1)
R(2,0) R(2,1) R(2,2)
R(3,0) R(3,1) R(3,2) R(3,3)
EE3561_Unit 7 Al-Dhaifallah1435 37
Property of Romberg Property of Romberg MethodMethod
)(),()(
Theorem
22 mb
a
hOmnRdxxf
R(0,0)
R(1,0) R(1,1)
R(2,0) R(2,1) R(2,2)
R(3,0) R(3,1) R(3,2) R(3,3)
)()()()( 8642 hOhOhOhOError Level
EE3561_Unit 7 Al-Dhaifallah1435 38
Example 1Example 1
3
1
2
1
8
3
3
1
8
3)0,0()0,1(
14
1)0,1()1,1(
1,1
)1,1()1,(14
1)1,(),(
8
3
4
1
2
1
2
1
2
1))(()0,0(
2
1)0,1(,
2
1
5.0102
1)()(
2)0,0(,1
Compute
1
1
0
2
RRRR
mnfor
mnRmnRmnRmnR
hafhRRh
bfafab
Rh
dxx
m
0.5
3/8 1/3
EE3561_Unit 7 Al-Dhaifallah1435 39
Example 1 cont.Example 1 cont.
3
1
3
1
3
1
15
1
3
1)1,1()1,2(
14
1)1,2()2,2(
3
1
8
3
32
11
3
1
32
11)0,1()0,2(
14
1)0,1()1,2(
)1,1()1,(14
1)1,(),(
32
11
16
9
16
1
4
1
8
3
2
1))3()(()0,1(
2
1)0,2(,
4
1
2
1
RRRR
RRRR
mnRmnRmnRmnR
hafhafhRRh
m
0.5
3/8 1/3
11/32 1/3 1/3
EE3561_Unit 7 Al-Dhaifallah1435 40
When do we stop?When do we stop?
( , ) ( , 1)
or
after a given number of steps
for example STOP at R(4,4)
STOP if
R n m R n m