chapter 7 numerical differentiation and integration

63
Lecture 34 Lecture 34 N um erical A nalysis N um erical A nalysis

Upload: georgia-beasley

Post on 18-Dec-2015

641 views

Category:

Documents


68 download

TRANSCRIPT

Page 1: Chapter 7 Numerical Differentiation and Integration

Lecture 34Lecture 34

Numerical Analysis

Numerical Analysis

Page 2: Chapter 7 Numerical Differentiation and Integration

Chapter 7Chapter 7 Numerical Numerical

Differentiation Differentiation and Integrationand Integration

Chapter 7Chapter 7 Numerical Numerical

Differentiation Differentiation and Integrationand Integration

Page 3: Chapter 7 Numerical Differentiation and Integration

INTRODUCTIONDIFFERENTIATION USING

DIFFERENCE OPREATORSDIFFERENTIATION USING

INTERPOLATIONRICHARDSON’S

EXTRAPOLATION METHODNUMERICAL INTEGRATION

Page 4: Chapter 7 Numerical Differentiation and Integration

NEWTON-COTES NEWTON-COTES INTEGRATION FORMULAEINTEGRATION FORMULAE

THE TRAPEZOIDAL RULE THE TRAPEZOIDAL RULE ( COMPOSITE FORM )( COMPOSITE FORM )SIMPSON’S RULES SIMPSON’S RULES ( COMPOSITE FORM )( COMPOSITE FORM )ROMBERG’S INTEGRATIONROMBERG’S INTEGRATIONDOUBLE INTEGRATIONDOUBLE INTEGRATION

Page 5: Chapter 7 Numerical Differentiation and Integration

Basic Issues in IntegrationBasic Issues in IntegrationWhat does an integralWhat does an integralrepresent?represent?

== AREA AREA

= = VOLUMEVOLUME

b

a

f (x)dxd b

c a

g(x, y) dx dy

Page 6: Chapter 7 Numerical Differentiation and Integration

NUMERICAL NUMERICAL INTEGRATIONINTEGRATION

Consider the definite integralConsider the definite integral

( )b

x aI f x dx

Page 7: Chapter 7 Numerical Differentiation and Integration

1

00 0 1 1

3

0 1

( ) Error

( ) ( )2 12

x

xf x dx c y c y

h hy y y

Page 8: Chapter 7 Numerical Differentiation and Integration

Then, if n = 2, the integration Then, if n = 2, the integration takes the formtakes the form

2

0

0 0 1 1 2 2

5( )

0 1 2

( )

Error

( 4 ) ( )3 90

x

x

iv

f x dx

x y x y x y

h hy y y y

Page 9: Chapter 7 Numerical Differentiation and Integration

Thus Simpson’s 1/3 rule is Thus Simpson’s 1/3 rule is based on fitting three points based on fitting three points with a quadratic.with a quadratic.

Similarly, for n = 3, the Similarly, for n = 3, the integration is found to be integration is found to be

Page 10: Chapter 7 Numerical Differentiation and Integration

3

0

0 1 2 3

5 ( )

( )

3 ( 3 3 )

83

h ( )80

x

x

iv

f x dx

h y y y y

y

Page 11: Chapter 7 Numerical Differentiation and Integration

This is known as Simpson’s This is known as Simpson’s 3/8 rule, which is based on 3/8 rule, which is based on fitting four points by a cubic. fitting four points by a cubic. Still higher order Newton-Still higher order Newton-Cotes integration formulae can Cotes integration formulae can be derived for large values of be derived for large values of n. n.

Page 12: Chapter 7 Numerical Differentiation and Integration

TRAPEZOIDAL RULETRAPEZOIDAL RULE

0

0 1 2

1

( )

( 2 22

2 )

nx

x

n n n

f x dx

hy y y

y y E

Page 13: Chapter 7 Numerical Differentiation and Integration

0

0 1 2

1

( )

( 2 22

2 )

nx

x

n n n

f x dx

hy y y

y y E

Page 14: Chapter 7 Numerical Differentiation and Integration

SIMPSON’S 1/3 RULESIMPSON’S 1/3 RULE

2

0

5( )

0 1 2

( )

( 4 ) ( )3 90

x

x

iv

I f x dx

h hy y y y

Page 15: Chapter 7 Numerical Differentiation and Integration

2

0

0 1 3 2 1

2 4 2 2 2

( )

[ 4( )3

2( ) ]

Error term

Nx

x

N

N N

f x dx

hy y y y

y y y y

Page 16: Chapter 7 Numerical Differentiation and Integration

4 ( )2 0 ( )180

ivNx xE h y

Page 17: Chapter 7 Numerical Differentiation and Integration

Simpson’s 3/8 rule isSimpson’s 3/8 rule is

1 2 3

4 5 6

3 2 1

( )

3[ ( ) 3 3 2

83 3 2

2 3 3 ( )]

b

a

n n n

f x dx

h y a y y y

y y y

y y y y b

Page 18: Chapter 7 Numerical Differentiation and Integration

with the global error with the global error EE given by given by

4 ( )0 ( )80

ivnx xE h y

Page 19: Chapter 7 Numerical Differentiation and Integration

ROMBERG’S INTEGRATION ROMBERG’S INTEGRATION

We have observed that the We have observed that the trapezoidal rule of integration trapezoidal rule of integration of a definite integral is of of a definite integral is of OO(h(h22), ), while that of Simpson’s 1/3 while that of Simpson’s 1/3 and 3/8 rules are of fourth-and 3/8 rules are of fourth-order accurate. order accurate.

Page 20: Chapter 7 Numerical Differentiation and Integration

We can improve the We can improve the accuracy of trapezoidal and accuracy of trapezoidal and Simpson’s rules using Simpson’s rules using Richardson’s extrapolation Richardson’s extrapolation procedure which is also procedure which is also called Romberg’s called Romberg’s integration method. integration method.

Page 21: Chapter 7 Numerical Differentiation and Integration

For example, the error in For example, the error in trapezoidal rule of a definite trapezoidal rule of a definite integralintegral

( )b

aI f x dx

Page 22: Chapter 7 Numerical Differentiation and Integration

can be written in the formcan be written in the form

2 41 2

63

TI I c h c h

c h

Page 23: Chapter 7 Numerical Differentiation and Integration

By applying Richardson’s By applying Richardson’s extrapolation procedure to extrapolation procedure to trapezoidal rule, we obtain the trapezoidal rule, we obtain the following general formula following general formula

Page 24: Chapter 7 Numerical Differentiation and Integration

( 1) ( 1) 1

1

2

42 2

4

Tm m

mT m T mm m

m

hI

h hI I

Page 25: Chapter 7 Numerical Differentiation and Integration

where where mm = 1, 2, … , = 1, 2, … , with with

IIT0T0 ( (hh) = I) = ITT ( (hh).).

For illustration, we consider For illustration, we consider the following example.the following example.

Page 26: Chapter 7 Numerical Differentiation and Integration

Example: Using Romberg’s Using Romberg’s integration method, find the value integration method, find the value ofof

starting with trapezoidal rule, starting with trapezoidal rule, for the tabular valuesfor the tabular values

1.8

1( )y x dx

Page 27: Chapter 7 Numerical Differentiation and Integration

x 1.0 1.1 1.2 1.3 1.4 1.5 1.6 1.7 1.8

y = f(x)

1.543 1.669 1.811 1.971 2.151 2.352 2.577 2.828 3.107

Page 28: Chapter 7 Numerical Differentiation and Integration

Solution TakingSolution Taking

0

0

1, 1.8,

1.8 1.0,

n

i

x x

h x x ihN

Page 29: Chapter 7 Numerical Differentiation and Integration

Let ILet ITT denote the integration by denote the integration by

Trapezoidal rule, then forTrapezoidal rule, then for

0 11, 0.8, ( )2

0.4(1.543 3.107) 1.8600

T

hN h I y y

Page 30: Chapter 7 Numerical Differentiation and Integration

0 1 2

2, 0.4,

( 2 ) 2

0.2[1.543 2(2.151)

3.107]

1.7904

TN h I

hy y y

Page 31: Chapter 7 Numerical Differentiation and Integration

0 1 2 3 4

4, 0.2,

[ 2( ) ]2

0.1[1.543 2(1.811 2.151

2.577) 3.107]

1.7728

TN h I

hy y y y y

Page 32: Chapter 7 Numerical Differentiation and Integration

Similarly for

8, 0.1,

1.7684T

N h

I

Page 33: Chapter 7 Numerical Differentiation and Integration

Now, using Romberg’s formula , we have

1

4(1.7904) 1.8600

2 3

1.7672

T

hI

Page 34: Chapter 7 Numerical Differentiation and Integration

2

2 2 2

4 (1.7728) 1.7672

2 4 1

1.77317

T

hI

Page 35: Chapter 7 Numerical Differentiation and Integration

Thus, after three steps, it is found that the value of the tabulated integral is 1.7671.

3

3 3 3

4 (1.7672) 1.77317

2 4 1

1.7671

T

hI

Page 36: Chapter 7 Numerical Differentiation and Integration

DOUBLE INTEGRATIONDOUBLE INTEGRATION

To evaluate numerically a To evaluate numerically a double integral of the formdouble integral of the form

( , )I x y dx dy

Page 37: Chapter 7 Numerical Differentiation and Integration

over a rectangular regionover a rectangular regionbounded by the lines bounded by the lines x = a, x =x = a, x =b, y = c, y = db, y = c, y = d we shall we shallemploy either trapezoidal ruleemploy either trapezoidal ruleor Simpson’s rule, repeatedlyor Simpson’s rule, repeatedlyWith respect to one variable atWith respect to one variable ata time. a time.

Page 38: Chapter 7 Numerical Differentiation and Integration

Noting that, both the Noting that, both the integrations are just a linear integrations are just a linear combination of values of the combination of values of the given function at different given function at different values of the independent values of the independent variable, we divide the interval variable, we divide the interval [a, b] into N equal [a, b] into N equal

Page 39: Chapter 7 Numerical Differentiation and Integration

sub-intervals of size h, such sub-intervals of size h, such that h = (b – a)/N; and that h = (b – a)/N; and the interval (c, d) into M equal the interval (c, d) into M equal sub-intervals of size k, so that sub-intervals of size k, so that k = (d – c)/M. Thus, we have k = (d – c)/M. Thus, we have

0 0, ,ix x ih x a

Page 40: Chapter 7 Numerical Differentiation and Integration

0 0

, for 1,2,..., 1

, ,

, for 1,2,..., 1

N

i

M

x b i N

y y ik y c

y d i M

Page 41: Chapter 7 Numerical Differentiation and Integration

Thus, we can generate a table Thus, we can generate a table of values of the integrand, and of values of the integrand, and the above procedure of the above procedure of integration is illustrated by integration is illustrated by considering a couple of considering a couple of examples.examples.

Page 42: Chapter 7 Numerical Differentiation and Integration

Example Evaluate the double Example Evaluate the double integralintegral

by using trapezoidal rule, with by using trapezoidal rule, with h = k = 0.25. h = k = 0.25.

2 2

1 1

dxdyI

x y

Page 43: Chapter 7 Numerical Differentiation and Integration

Solution Taking x = 1, 1.25, Solution Taking x = 1, 1.25, 1.50, 1.75, 2.0 and y = 1, 1.25, 1.50, 1.75, 2.0 and y = 1, 1.25, 1.50, 1.75, 2.0, the following 1.50, 1.75, 2.0, the following table is generated using the table is generated using the integrandintegrand

1( , )f x y

x y

Page 44: Chapter 7 Numerical Differentiation and Integration

x y

1.00 1.25 1.50 1.75 2.00

1.00 0.5 0.4444 0.4 0.3636 0.3333

1.25 0.4444 0.4 0.3636 0.3333 0.3077

1.50 0.4 0.3636 0.3333 0.3077 0.2857

1.75 0.3636 0.3333 0.307 0.2857 0.2667

2.00 0.3333 0.3077 0.2857 0.2667 0.25

Page 45: Chapter 7 Numerical Differentiation and Integration

Keeping one variable say Keeping one variable say xx fixed and varying the fixed and varying the variable y, the application variable y, the application of trapezoidal rule to each of trapezoidal rule to each row in the above table row in the above table givesgives

Page 46: Chapter 7 Numerical Differentiation and Integration

2

1(1, )

0.25 [0.5 2(0.4444 0.4

2 0.3636) 0.3333]

0.4062

f y dy

Page 47: Chapter 7 Numerical Differentiation and Integration

2

1(1.25, )

0.25[0.4444 2(0.4

2 0.3636 0.3333) 0.3077]

0.3682

f y dy

Page 48: Chapter 7 Numerical Differentiation and Integration

2

1(1.5, )

0.25[0.4 2(0.3636

2 0.3333 0.3077)] 0.2857

0.3369

f y dy

Page 49: Chapter 7 Numerical Differentiation and Integration

2

1(1.75, )

0.25[0.3636 2(0.3333

20.3077 0.2857) 0.2667]

0.3105

f y dy

Page 50: Chapter 7 Numerical Differentiation and Integration

and

2

1(2, )

0.25[0.3333 2(0.3077

20.2857) 0.25]

0.2879

f y dy

Page 51: Chapter 7 Numerical Differentiation and Integration

Therefore,

2 2

1 1

(1, ) 2[ (1.25, )2(1.5, ) (1.75, )] (2, )

dxdyI

x y

hf y f y

f y f y f y

Page 52: Chapter 7 Numerical Differentiation and Integration

By use of the last equations By use of the last equations we get the required result as we get the required result as

0.25.04602 2(0.3682 0.3369

20.3105) 0.2879 0.3407

I

Page 53: Chapter 7 Numerical Differentiation and Integration

Example :EvaluateExample :Evaluate

by numerical double by numerical double integration.integration.

/ 2 / 2

0 0sin( )x y dxdy

Page 54: Chapter 7 Numerical Differentiation and Integration

( , ) sin( )f x y x y

Solution Taking x = y = Solution Taking x = y = π/4, 3 π /8, π /2, we can π/4, 3 π /8, π /2, we can generate the following generate the following table of the integrandtable of the integrand

Page 55: Chapter 7 Numerical Differentiation and Integration

x y

0 π/8 π/4 3π/8 π/2

0 0.0 0.6186 0.8409 0.9612

1.0

π/8 0.6186 0.8409 0.9612 1.0 0.9612

π/4 0.8409 0.9612 1.0 0.9612

0.8409

3π/8 0.9612 1.0 0.9612 0.8409

0.6186

π/2 1.0 0.9612 0.8409 0.6186

0.0

Page 56: Chapter 7 Numerical Differentiation and Integration

Keeping one variable as say Keeping one variable as say xx fixed and fixed and yy as variable, and as variable, and applying trapezoidal rule to applying trapezoidal rule to each row of the above table, each row of the above table, we getwe get

Page 57: Chapter 7 Numerical Differentiation and Integration

/ 2

0(0, )

0.0 2(0.6186 0.840916

0.9612) 1.0 1.1469

f y dx

Page 58: Chapter 7 Numerical Differentiation and Integration

2

0,

8

0.6186 2(0.8409 0.9612161.0) 0.9612 1.4106

y dx

Page 59: Chapter 7 Numerical Differentiation and Integration

Similarly, we getSimilarly, we get

2

0

2

0

, 1.4778,4

3, 1.4106.

8

f y dx

f y dx

Page 60: Chapter 7 Numerical Differentiation and Integration

andand

2

0, 1.1469

2f y dx

Page 61: Chapter 7 Numerical Differentiation and Integration

Using these results, we finally Using these results, we finally obtainobtain

2 2

0 0sin( )

(0, ) 2 , ,16 8 4

3, ,

8 2

x y dxdy

f y y f y

f y f y

Page 62: Chapter 7 Numerical Differentiation and Integration

1.1469 2(1.4106161.4778 1.4106) 1.1469

2.1386

Page 63: Chapter 7 Numerical Differentiation and Integration

Lecture 34Lecture 34

Numerical Analysis

Numerical Analysis