Docsity

Notes on Numerical Integration - Computational Methods | CMSC 460, Study notes of Computer Science

Partial preview of the text

Download Notes on Numerical Integration - Computational Methods | CMSC 460 and more Study notes Computer Science in PDF only on Docsity!

Computational Methods

CMSC/AMSC/MAPL 460

Numerical Integrat

ion

Ramani Duraiswami,

Dept. of Computer Science

12 10 8 6 4 2 0

3

5

7

9

11

13

15

Numerical Integration^ Numerical Integration

Idea is to do integral in small parts, like the way youfirst learned integration - a summationNumerical methods just try to make it faster andmore accurate

Numerical IntegrationNumerical Integration

Characterized by where the function isevaluated

Newton-Cotes Closed Formulae -- Use both endpoints

Trapezoidal Rule : Linear

Simpson’s 1/3-Rule : Quadratic

Simpson’s 3/8-Rule : Cubic

Boole’s Rule : Fourth-order

Newton-Cotes Open Formulae -- Use onlyinterior points

midpoint rule

Trapezoid RuleTrapezoid Rule

Straight-line approximation

[

] ) x ( f ) x ( f

h^2

) x ( f c ) x ( f c ) x ( f c

dx

x

f

1

0

1 1 0 0 i 1

0 i

i

b a

=

x

x

x

f(x)

L(x)

Simpson’Simpson

’s 1/

s 1/3-

-Rule

Rule

Approximate the function by a parabola

[

] ) x ( f ) x ( f 4 ) x ( f

h^3

) x ( f c ) x ( f c ) x ( f c ) x ( f c

dx ) x ( f

2

1

0

2 2 1 1 0 0 i 2

0 i

i

b a

=

x

x

x

f(x)

x

h

h

L(x)

Simpson’Simpson

’s 3/

s 3/8-

-Rule

Rule

Approximate by a cubic polynomial

[

] ) x ( f ) x ( f 3 ) x ( f 3 ) x ( f

h 3 8

)

f(x

c

)

f(x

c

)

f(x

c

)

f(x

c ) x ( f c

dx ) x ( f

3

2

1

0

3 3 2 2 1 1 0 0 i

3 0 i

i

b a

=

=

≈

=

x

x

x

f(x)

x

h

h

L(x)

x

h

Midpoint RuleMidpoint Rule

Newton-Cotes Open Formula

f

) a b ( ) 2

b a ( f ) a b (

) x ( f ) a b (

dx

x

f

3

m

b a

η

a

b

x

f(x)

xm

Two-Two

-point Newton

point Newton-

-Cotes Open

Cotes Open

FormulaFormula

Approximate by a straight line

[

]

)

(

f

108

) a b ( ) x ( f ) x ( f 2

a

b

dx ) x ( f

3

2

1

b a

η ′′

− + + − ≈ ∫

x

x

x

f(x)

x

h

h

x

h

Better Numerical IntegrationBetter Numerical Integration

Composite integration

Composite Trapezoidal Rule

Composite Simpson’s Rule

Richardson Extrapolation

Romberg integration

Apply trapezoid rule to multiple segments overApply trapezoid rule to multiple segments overintegration limitsintegration limits

7 6 5 4 3 2 1 0 3

5

7

9

11

13

15

Two segments 7 6 5 4 3 2 1 03

5

7

9

11

13

15

Four segments

7 6 5 4 3 2 1 0 3

5

7

9

11

13

15

Many segments 7 6 5 4 3 2 1 03

5

7

9

11

13

15

Three segments

Composite Trapezoid RuleComposite Trapezoid Rule

Evaluate the integral

dx

xe

I

(^40)

x 2

∫

[

]

[

]

[

]

[

]

[

]^

% (^66). 2

(^95).

5355

) 4 ( f

)

(^75). 3 ( f 2

) (^5). 3 ( f 2

) (^5). 0 ( f 2

)

(^25). 0 ( f 2 ) 0 ( f

h^2

I

(^25). 0

h ,

16

n

% (^50).

10

(^76).

5764

) 4 ( f

) (^5). 3 ( f 2

) 3 ( f 2 )

(^5). 2 ( f 2 ) 2 ( f 2 )

(^5). 1 ( f 2

) 1 ( f 2 )

(^5). 0 ( f 2 ) 0 ( f

h^2

I

(^5). 0

h , 8

n

% (^71).

39

(^79).

7288

) 4 ( f ) 3 ( f 2

) 2 ( f 2 ) 1 ( f 2 ) 0 ( f

h 2

I

1

h, 4

n

% (^75).

132

(^23).

12142

) 4 ( f ) 2 ( f 2 ) 0 ( f

h^2

I

2

h, 2

n

% (^12).

357

(^66).

23847

) 4 ( f ) 0 ( f

h 2

I 4 h , 1 n

−

=

      • = ⇒ = =

−

=

    • = ⇒ = =

−

=

    • = ⇒ = =

− = = + + = ⇒ = = − = = + = ⇒ = = ε ε ε ε ε L

Composite Trapezoid Rule with UnequalComposite Trapezoid Rule with Unequal

SegmentsSegments

Evaluate the integral •

h

1

= 2, h

2

= 1, h

3

= 0.5, h

4

dx

xe

I

(^40)

x 2

∫

[

]

[

]

[

]

[

]

[

]

[

]

[

]

[

]

3e

8

7

7

6

6

4

4

4

3

2

1

4 (^5). 3

(^5). (^33)

(^32)

(^20)

∫

∫

∫

∫

e

e

e

e

e

e

f f h f f h

f f h f f h

dx x

f

dx x

f

dx x

f

dx x

f

I

[

]

[

]

[

]

[

] ) x ( f ) x ( f 4 ) x ( f 2 )

4f(x

) x ( f 2 )

f(x 4

2f(x

f(x 4

2f(x

f(x 4

f(x

h^3

f(x

4f(x

f(x

h 3

f(x

f(x 4

f(x

h^3

f(x

f(x 4

f(x

h^3

f(x)dx

f(x)dx

f(x)dx

f(x)dx

n

1 n

2 n

1

2i

i 2

(^1) - 2i

4

3

2

1

0

n

1 n

2 n

4 3 2 2 1 0

x x

x x

x x

b a

n

2 n

(^42)

(^20)

−

−

−

−

∫

∫

∫

∫

−

L
L
L
L

Composite Simpson’^ Composite Simpson

’s Rule

s Rule

Multiple applications of Simpson’s rule

Composite Simpson’Composite Simpson

’s Rule

s Rule

Evaluate the integral •

n = 2, h = 2

n = 4, h = 1

dx

xe

I

(^40)

x 2

∫

[

]

[

]

e 4 ) e 3 ( 4 ) e 2 ( 2 ) e ( 4 0

) 4 ( f ) 3 ( f 4 ) 2 ( f 2 ) 1 ( f 4 ) 0 ( f

h^3

I

8

6

4

2

[

]

[

]

%

(^96).

57

(^411).

8240

e 4 ) e 2 ( 4 0

2 3

) 4 ( f ) 2 ( f 4 ) 0 ( f

h 3

I

8

4

− = ⇒ = + + =

=

ε