59
SE301:Numerical Methods Topic 6 Numerical Integration SE301_Topic 6 Al-Amer2005 ١ Dr. Samir Al-Amer Term 063

SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

  • Upload
    others

  • View
    7

  • Download
    0

Embed Size (px)

Citation preview

Page 1: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301:Numerical MethodsTopic 6

Numerical Integration

SE301_Topic 6 Al-Amer2005 ١

Dr. Samir Al-Amer Term 063

Page 2: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

Lecture 17 Introduction to Numerical

Integration

SE301_Topic 6 Al-Amer2005 ٢

DefinitionsUpper and Lower SumsTrapezoid MethodExamples

Page 3: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٣

IntegrationIntegrationDefinite Integrals

Definite Integrals are numbers.

21

2

1

0

1

0

2

==∫xxdx

Indefinite Integrals

Indefinite Integrals of a function are functionsthat differ from each other by a constant.

∫ += cxdxx2

2

Page 4: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٤

Fundamental Theorem of CalculusFundamental Theorem of Calculus

for solution form closedNo

for tiveantideriva no is There

) f(x)(x) 'F (i.e. f of tiveantideriva is , intervalan 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

Page 5: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٥

The Area Under the CurveThe Area Under the Curve

One interpretation of the definite integral is

Integral = area under the curve

f(x)

∫=b

af(x)dxArea

a b

Page 6: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٦

Numerical Integration Methods

Numerical integration Methods Covered in this course

Upper and Lower Sums

Newton-Cotes Methods:

Trapezoid Rule

Simpson Rules

Romberg Method

Gauss Quadrature

Page 7: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٧

Upper and Lower SumsUpper and Lower SumsThe interval is divided into subintervals

f(x)

a b3210 xxxx

{ }

{ }{ }

( )

( )ii

n

ii

ii

n

ii

iii

iii

n

xxMPfUsumUpper

xxmPfLsumLower

xxxxfMxxxxfm

Define

bxxxxaPPartition

−=

−=

≤≤=≤≤=

=≤≤≤≤==

+

=

+

=

+

+

1

1

0

1

1

0

1

1

210

),(

),(

:)(max:)(min

...

Page 8: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٨

Upper and Lower SumsUpper and Lower Sums

( )

( )

2

2 integral theof Estimate

),(

),(

1

1

0

1

1

0

LUError

UL

xxMPfUsumUpper

xxmPfLsumLower

ii

n

ii

ii

n

ii

−≤

+=

−=

−=

+

=

+

=

f(x)

3210 xxxxa b

Page 9: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٩

ExampleExample

3,2,1,041

1,169,

41,

161

169,

41,

161,0

)intervals equalfour (4

1,43,

42,

41,0

1

3210

3210

1

0

2

==−

====

====

=⎭⎬⎫

⎩⎨⎧=

+

iforxx

MMMM

mmmm

n

PPartition

dxx

ii 143

21

410

Page 10: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ١٠

ExampleExample( )

( )

81

6414

6430

21

3211

6414

6430

21integraltheofEstimate

64301

169

41

161

41),(

),(

6414

169

41

1610

41),(

),(

1

1

0

1

1

0

=⎟⎠⎞

⎜⎝⎛ −<

=⎟⎠⎞

⎜⎝⎛ +=

=⎥⎦⎤

⎢⎣⎡ +++=

−=

=⎥⎦⎤

⎢⎣⎡ +++=

−=

+

=

+

=

Error

PfU

xxMPfUsumUpper

PfL

xxmPfLsumLower

ii

n

ii

ii

n

ii

143

21

410

Page 11: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ١١

Upper and Lower SumsUpper and Lower Sums

• Estimates based on Upper and Lower Sums are easy to obtain for monotonicfunctions (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.

Page 12: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ١٢

Newton-Cotes MethodsIn Newton-Cote Methods, the function is approximated by a polynomial of order nComputing the integral of a polynomial is easy.

( )

1)(...

2)()()(

...)(1122

10

10

+−

++−

+−≈

+++≈

++

∫∫

nabaabaabadxxf

dxxaxaadxxfnn

n

b

a

b

a

nn

b

a

Page 13: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ١٣

Newton-Cotes MethodsTrapezoid 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

)(

)(

Page 14: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ١٤

Trapezoid MethodTrapezoid Method

)()()()( axab

afbfaf −−−

+

f(x)

ba ( )2

)()(

2)()(

)()()(

)()()()(

)(

2

afbfab

xab

afbf

xab

afbfaaf

dxaxab

afbfafI

dxxfI

b

a

b

a

b

a

b

a

+−=

−−

+

⎟⎠⎞

⎜⎝⎛

−−

−=

⎟⎠⎞

⎜⎝⎛ −

−−

+≈

=

Page 15: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ١٥

Trapezoid MethodDerivation-One interval

( )

( )2

)()(

)()(2

)()()()()(

2)()()()()(

)()()()()(

)()()()()(

22

2

afbfab

abab

afbfabab

afbfaaf

xab

afbfxab

afbfaaf

dxxab

afbfab

afbfaafI

dxaxab

afbfafdxxfI

b

a

b

a

b

a

b

a

b

a

+−=

−−−

+−⎟⎠⎞

⎜⎝⎛

−−

−=

−−

+⎟⎠⎞

⎜⎝⎛

−−

−=

⎟⎠⎞

⎜⎝⎛

−−

+−−

−≈

⎟⎠⎞

⎜⎝⎛ −

−−

+≈=

∫∫

Page 16: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ١٦

Trapezoid MethodTrapezoid Method

f(x)

)(bf

( ))()(2

bfafabArea +−

=

)(af

ba

Page 17: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ١٧

Trapezoid MethodTrapezoid MethodMultiple Application RuleMultiple Application Rule

f(x)

s trapezoid theof

areas theof sum)(

... segments into dpartitione

is b][a, intervalThe

210

=

=≤≤≤≤=

∫b

a

n

dxxf

bxxxxan

( )1212

2)()( xxxfxfArea −

+=

x3210 xxxx

a b

Page 18: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ١٨

Trapezoid MethodTrapezoid MethodGeneral Formula and special caseGeneral Formula and special case

( )( ))()(21)(

... 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

)()()(21)(

allfor points) base spacedEqualiy ( CaseSpecial

n

iin

b

a

ii

xfxfxfhdxxf

ihxx

Page 19: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ١٩

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

Page 20: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٢٠

Example 1Example 1

Time (s) 0.0 1.0 2.0 3.0

Velocity (m/s)

0.0 10 12 14

{ }3,2,1,0are points Baselssubinterva3 into

divided is interval The

( )

29)140(2112)(101 Distance

)()(21)(

1

0

1

1

1

=⎥⎦⎤

⎢⎣⎡ +++=

⎥⎦

⎤⎢⎣

⎡++=

=−=

∑−

=

+

n

n

ii

ii

xfxfxfhT

xxhMethodTrapezoid

Page 21: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٢١

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

Page 22: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٢٢

Error in estimating the integralError in estimating the integralTheoremTheorem

)(''max12

)(12

then)( eapproximat

toused is Method Trapezoid If :Theorem) (width intervals Equal

on continuous is)('' :Assumption

],[

2

''2

a

xfhabError

[a,b]wherefhabError

dxxf

h[a,b]xf

bax

b

−≤

∈−

−=

=

∫ξξ

Page 23: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٢٣

ExampleExample

52

52

],[

2

5

0

106

1021

121)(''

)sin()('');cos()(';0;

)(''max12

1021 error ,)sin(

×≤⇒

×≤≤⇒≤

−====

−≤

×≤∫

π

ππ

π

h

hErrorxf

xxfxxfab

xfhabError

thatsohfinddxx

bax

Page 24: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٢٤

ExampleExample

x 1.0 1.5 2.0 2.5 3.0

f(x) 2.1 3.2 3.4 2.8 2.7

( )( )

( )⎥⎦

⎤⎢⎣

⎡++=

−=

+−=

=

+

++

=

)()(21)(),(

, allfor :

)()(21),(

)(Compute tomethod TrapezoidUse

0

1

1

1

11

1

0

3

1

n

n

ii

ii

iiii

n

i

xfxfxfhPfT

ixxhCaseSpecial

xfxfxxPfTTrapezoid

dxxf

Page 25: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٢٥

ExampleExample

x 1.0 1.5 2.0 2.5 3.0

f(x) 2.1 3.2 3.4 2.8 2.7

( )

( )

9.5

7.21.2218.24.32.35.0

)()(21)()( 0

1

1

3

1

=

⎥⎦⎤

⎢⎣⎡ ++++=

⎥⎥⎦

⎢⎢⎣

⎡++≈ ∑∫

=n

n

ii xfxfxfhdxxf

Page 26: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301: Numerical Method

Lecture 18Recursive Trapezoid Method

SE301_Topic 6 Al-Amer2005 ٢٦

Recursive formula is used

Page 27: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٢٧

Recursive Trapezoid MethodRecursive Trapezoid Method

f(x)

( ))()(2

)0,0(R

intervaloneonbasedEstimate

bfafababh

+−

=

−=

haa +

Page 28: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٢٨

Recursive Trapezoid MethodRecursive Trapezoid Method

f(x)

hahaa 2++

( )

[ ])()0,0(21)0,1(

)()(21)(

2)0,1(R

2

intervals 2on based Estimate

hafhRR

bfafhafab

abh

++=

⎥⎦⎤

⎢⎣⎡ +++

−=

−=

Based on previous estimate

Based on new point

Page 29: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٢٩

Recursive Trapezoid MethodRecursive Trapezoid Method

f(x)

[

( )

[ ])3()()0,1(21)0,2(

)()(21

)3()2()(4

)0,2(R

4

hafhafhRR

bfaf

hafhafhafab

abh

++++=

⎥⎦⎤++

+++++−

=

−=

hahaa 42 ++Based on previous estimate

Based on new points

Page 30: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٣٠

Recursive Trapezoid MethodRecursive Trapezoid MethodFormulasFormulas

[ ]

( )

n

k

abh

hkafhnRnR

bfafab

n

2

)12()0,1(21)0,(

)()(2

)0,0(R

)1(2

1

−=

⎥⎦

⎤⎢⎣

⎡−++−=

+−

=

∑−

=

Page 31: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٣١

Recursive Trapezoid MethodRecursive Trapezoid Method

[ ]

( )

( )

( )

( )⎥⎦

⎤⎢⎣

⎡−++−=

−=

⎥⎦

⎤⎢⎣

⎡−++=

−=

⎥⎦

⎤⎢⎣

⎡−++=

−=

⎥⎦

⎤⎢⎣

⎡−++=

−=

+−

=−=

=

=

=

=

)1(

2

2

1

2

13

2

12

1

1

)12()0,1(21)0,(,

2

..................

)12()0,2(21)0,3(,

2

)12()0,1(21)0,2(,

2

)12()0,0(21)0,1(,

2

)()(2

)0,0(R,

n

kn

k

k

k

hkafhnRnRabh

hkafhRRabh

hkafhRRabh

hkafhRRabh

bfafababh

Page 32: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٣٢

Advantages of Recursive TrapezoidRecursive Trapezoid:

Gives the same answer as the standard Trapezoid method. Make use of the available information to reduce computation time.Useful if the number of iterations is not known in advance.

Page 33: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301:Numerical Methods19. Romberg Method

SE301_Topic 6 Al-Amer2005 ٣٣

MotivationDerivation of Romberg Method

Romberg MethodExample

When to stop?

Page 34: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٣٤

Motivation for Romberg MethodMotivation for Romberg MethodTrapezoid formula with an interval h gives error of the order O(h2)We can combine two Trapezoid estimates with intervals 2h and h to get a better estimate.

Page 35: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٣٥

Romberg MethodRomberg Method

dx f(x) ofion approximat theimprove tocombined are

4h,8h,...2h,h,sizeofintervalswith methodTrapezoid using Estimatesb

a∫

First column is obtained using Trapezoid Method

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)The other elements are obtained using the Romberg Method

Page 36: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٣٦

First Column First Column Recursive Trapezoid MethodRecursive Trapezoid Method

[ ]

( )

n

k

abh

hkafhnRnR

bfafab

n

2

)12()0,1(21)0,(

)()(2

)0,0(R

)1(2

1

−=

⎥⎦

⎤⎢⎣

⎡−++−=

+−

=

∑−

=

Page 37: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٣٧

Derivation of Romberg MethodDerivation of Romberg Method

[ ] ...)0,1()0,(31)0,()(

2*41

)2(...641

161

41)0,()(

R(n,0)by 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

Page 38: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٣٨

Romberg MethodRomberg Method

[ ]

( )

[ ]1,1

)1,1()1,(14

1)1,(),(

)12()0,1(21)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)

Page 39: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٣٩

Property of Romberg MethodProperty of Romberg MethodR(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))(),()(

Theorem

22 ++=∫ mb

a

hOmnRdxxf

)()()()( 8642 hOhOhOhOError Level

Page 40: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٤٠

Example 1Example 1

[ ] [ ]

[ ]

[ ]31

21

83

31

83)0,0()0,1(

141)0,1()1,1(

1,1

)1,1()1,(14

1)1,(),(

83

41

21

21

21))(()0,0(

21)0,1(,

21

5.01021)()(

2)0,0(,1

Compute

1

1

02

=⎥⎦⎤

⎢⎣⎡ −+=−

−+=

≥≥

−−−−−

+−=

=⎟⎠⎞

⎜⎝⎛+⎟

⎠⎞

⎜⎝⎛=++==

=+=+−

==

RRRR

mnfor

mnRmnRmnRmnR

hafhRRh

bfafabRh

dxx

m

0.5

3/8 1/3

Page 41: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٤١

0.5

3/8 1/3

11/32 1/3 1/3

Example 1 cont.Example 1 cont.

[ ]

[ ]

[ ]31

31

31

151

31)1,1()1,2(

141)1,2()2,2(

31

83

3211

31

3211)0,1()0,2(

141)0,1()1,2(

)1,1()1,(14

1)1,(),(

3211

169

161

41

83

21))3()(()0,1(

21)0,2(,

41

2

1

=⎥⎦⎤

⎢⎣⎡ −+=−

−+=

=⎥⎦⎤

⎢⎣⎡ −+=−

−+=

−−−−−

+−=

=⎟⎠⎞

⎜⎝⎛ ++⎟

⎠⎞

⎜⎝⎛=++++==

RRRR

RRRR

mnRmnRmnRmnR

hafhafhRRh

m

Page 42: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٤٢

When do we stop?When do we stop?

R(4,4)at STOP examplefor steps ofnumber given aafter

or )1,1()1,( ε≤−−−− mnRmnR

ifSTOP

Page 43: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301:Numerical Methods20. Gauss Quadrature

SE301_Topic 6 Al-Amer2005 ٤٣

MotivationGeneral integration formula

Read 22.3-22.3

Page 44: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٤٤

MotivationMotivation

( )

⎩⎨⎧

=−=

=

=

⎥⎦

⎤⎢⎣

⎡++=

∑∫

∑∫

=

=

nandihnih

cwhere

xfcdxxf

xfxfxfhdxxf

i

n

iii

b

a

n

ini

b

a

05.01,...,2,1

)()(

as expressed becan It

)()(21)()(

Method Trapezoid

0

1

10

Page 45: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٤٥

General Integration FormulaGeneral Integration Formula

integral theofion approximat good gives formula that thesoselect wedo How

:Problem::

)()(0

ii

ii

n

iii

b

a

xandc

NodesxWeightsc

xfcdxxf ∑∫=

=

Page 46: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٤٦

Lagrange InterpolationLagrange Interpolation

∫∑∫

∫ ∑∫∫

∫∫

=≈⇒

⎟⎠

⎞⎜⎝

⎛=≈

=

=

b

a ii

n

iii

b

a

b

a i

n

ii

b

a n

b

a

n

n

b

a n

b

a

dxxcwherexfcdxxf

dxxfxdxxPdxxf

xxxxPwhere

dxxPdxxf

)()()(

)()()()(

,...,, nodes at thef(x) einterpolat that polynomial a is )(

)()(

0

0

10

l

l

Page 47: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٤٧

QuestionQuestion

What is the best way to choose the nodes and the weights?

Page 48: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٤٨

Theorem Theorem

12norder of spolynomial allfor exact be willformula The

)()()(

then)( of zeros theare,...,,,Let

00)(

such that 1n degree of polynomial nontrivial a be Let

0

210

+≤

=≈

≤≤=

+

∫∑∫

=

dxxcwherexfcdxxf

xqxxxx

nkdxxqx

q

i

b

ai

n

iii

b

a

n

kb

a

l

Page 49: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٤٩

Determining The Weights and NodesDetermining The Weights and Nodes

?5order of spolynomial allfor exact is formula that theso

weights theand nodes select the wedo How

)()()()( 221100

1

1

++=∫− xfcxfcxfcdxxf

Page 50: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٥٠

Determining The Weights and NodesDetermining The Weights and NodesSolutionSolution

5,3,0solution possible one

0)(

0)(

0)(

satisfy must )()(

3120

1

1

2

1

1

1

1

33

2210

=−===

=

=

=

+++=

∫∫∫

aaaa

dxxxq

xdxxq

dxxq

xqxaxaxaaxqLet

Page 51: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٥١

Theorem Theorem

12norder of spolynomial allfor exact be willformula The

)()()(

then)( of zeros theare,...,,,Let

00)(

such that 1n degree of polynomial nontrivial a be Let

0

210

+≤

=≈

≤≤=

+

∫∑∫

=

dxxcwherexfcdxxf

xqxxxx

nkdxxqx

q

i

b

ai

n

iii

b

a

n

kb

a

l

Page 52: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٥٢

Determining The Weights and NodesDetermining The Weights and NodesSolutionSolution

( ) ⎟⎟⎠

⎞⎜⎜⎝

⎛++⎟⎟

⎞⎜⎜⎝

⎛−=

==−=

±

+−=

∫−

− 530

53)(

use we weightsobtain the To

53 0,,

53are nodes The

53 0, are)(

53)(

210

1

1

210

3

fAfAfAdxxf

xxx

xqofroots

xxxqLet

Page 53: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٥٣

Determining The Weights and NodesDetermining The Weights and NodesSolutionSolution

( ) ⎟⎟⎠

⎞⎜⎜⎝

⎛++⎟⎟

⎞⎜⎜⎝

⎛−=

=

===

==−=

∫− 53

950

98

53

95)(

2)(n Quadrature Gauss The

95 ,

98,

95are weightsThe

53 0,,

53are nodes The

1

1

210

210

fffdxxf

AAA

xxx

Page 54: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٥٤

626

Gaussian Gaussian QuadratureQuadratureSee more in Table 22.1 (page 626)See more in Table 22.1 (page 626)

236926.0,478628.0,568889.0,478628.0,236926.0906179.0,538469.0,00000.0,538469.0,906179.04

34785.0,65214.0,65214.0,34785.086113.0,33998.0,33998.0,86113.03

555556.0,888889.0,555556.0774596.0,000000.0,774596.02

1,157735.0,57735.01

)()(

43210

43210

3210

3210

210

210

10

10

0

1

1

========−=−==

======−=−==

=====−==

===−==

=∑∫=

cccccxxxxxn

ccccxxxxn

cccxxxn

ccxxn

xfcdxxfn

iii

Page 55: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٥٥

627

Error Analysis for Gauss Error Analysis for Gauss QuadratureQuadrature

[ ][ ]

12norder of spolynomial allfor exact be willformula The

]1,1[),()!22()32(

)!1(2Error

satisfieserror true then theformula Quadrature Gauss toaccording selected are

)()(

by edapproximat be)( integral theLet

)22(3

432n

0

+≤

−∈++

+=

++

=∑∫

ξξn

ii

n

iii

b

a

b

a

fnn

n

xandcwhere

xfcdxxf

dxxf

Page 56: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٥٦

ExampleExample

1n with QuadratureGaussian using1

0

2

=∫ − dxeEvaluate x

b. and aarbitrary for

)(compute toformula theuse wedo How

31

31)(

1

1

∫ ⎟⎟⎠

⎞⎜⎜⎝

⎛+⎟⎟⎠

⎞⎜⎜⎝

⎛−=

b

adxxf

ffdxxf

∫∫ −⎟⎠⎞

⎜⎝⎛ +

+−−

=1

1 222)( dtabtabfabdxxf

b

a

Page 57: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٥٧

ExampleExample

( )

⎥⎥⎥

⎢⎢⎢

+=

=

⎟⎟⎠

⎞⎜⎜⎝

⎛+−⎟⎟

⎞⎜⎜⎝

⎛+−−

−+−− ∫∫

22

22

5.315.05.

315.0

1

15.5.1

0

21

21

ee

dtedxe tx

Page 58: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٥٨

627

Improper IntegralsImproper Integrals

∫∫

∫∫

⎟⎟⎟⎟⎟

⎜⎜⎜⎜⎜

⎟⎠⎞

⎜⎝⎛

=

>⎟⎠⎞

⎜⎝⎛=

⇒∞−∞

∞ 1

0 221 2

1

1 2a

1

111

:function new on the method apply the and

)0 assuming(,11)(

following thelikeation transforma Use)or is limits theof oneintegrals(improper eapproximat

odirectly t used benot can earlier discussed Methods

dt

tt

dxx

Example

abdtt

ft

xf a

b

b

Page 59: SE301:Numerical Methods Topic 6 · 2008. 3. 8. · SE301_Topic 6 Al-Amer2005 ٣ Integration Definite Integrals Definite Integrals are numbers. 2 1 2 1 0 1 0 2 ∫ = = x xdx Indefinite

SE301_Topic 6 Al-Amer2005 ٥٩

QuizQuiz

x 1.0 1.5 2.0 2.5 3.0

f(x) 2.1 3.2 3.4 2.8 2.7

( )( )

( )⎥⎦

⎤⎢⎣

⎡++=

−=

+−=

=

+

++

=

)()(21)(),(

, allfor :

)()(21),(

)(Compute tomethod TrapezoidUse

0

1

1

1

11

1

0

3

1

n

n

ii

ii

iiii

n

i

xfxfxfhPfT

ixxhCaseSpecial

xfxfxxPfTTrapezoid

dxxf