22
Chapter 7 Numerical Integratio n Lecture 8

Lecture 8. Integration Indefinite Integrals Indefinite Integrals of a function are functions that differ from each other by a constant. Definite Integrals

Embed Size (px)

Citation preview

Page 1: Lecture 8. Integration Indefinite Integrals Indefinite Integrals of a function are functions that differ from each other by a constant. Definite Integrals

Chapter 7Numerical

Integration

Lecture 8

Page 2: Lecture 8. Integration Indefinite Integrals Indefinite Integrals of a function are functions that differ from each other by a constant. Definite Integrals

Integration

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

Page 3: Lecture 8. Integration Indefinite Integrals Indefinite Integrals of a function are functions that differ from each other by a constant. Definite Integrals

for solution form closedNo

for tiveantideriva no is There2

2

b

a

x

x

dxe

e

Why Numerical Integration?

• Very often, the function f(x) to differentiate or the integrand to integrate is too complex to derive exact analytical solutions.

• In most cases in engineering, the function f(x) is only available in a tabulated form with values known only at discrete points.

Numerical Solution

Page 4: Lecture 8. Integration Indefinite Integrals Indefinite Integrals of a function are functions that differ from each other by a constant. Definite Integrals

The general form of numerical integration of a function f (x) over some interval [a, b] is a weighted sum of the function values at a finite number (n) of sample points (nodes), referred to as ‘quadrature’:

Numerical Integration

Page 5: Lecture 8. Integration Indefinite Integrals Indefinite Integrals of a function are functions that differ from each other by a constant. Definite Integrals

b

af(x)dxArea

One interpretation of the definite integral is

Integral = area under the curve

a b

f(x)

Page 6: Lecture 8. Integration Indefinite Integrals Indefinite Integrals of a function are functions that differ from each other by a constant. Definite Integrals

Newton-Cotes IntegrationCommon numerical integration schemeBased on the strategy of replacing a

complicated function or tabulated data with some approximating function that is easy to integrate

nnn

b

a

n

b

a

xaxaaxPxf

dxxPdxxfI

....)( 10

Pn(x) is an nth orderpolynomial

Page 7: Lecture 8. Integration Indefinite Integrals Indefinite Integrals of a function are functions that differ from each other by a constant. Definite Integrals

Trapezoidal RuleCorresponds to the case where the

polynomial is a first order

b

a

b

a

dxxPdxxfI 1

0

1

2

3

4

5

0 5 10

x

f(x)

h

F(a)

F(b)

Page 8: Lecture 8. Integration Indefinite Integrals Indefinite Integrals of a function are functions that differ from each other by a constant. Definite Integrals

From the trapezoidal rule we can obtain for the total area of (n-1) intervals

0

1

2

3

4

5

0 1 2 3 4 5 6 7 8 9 10

x

f(x)

222

13221 nn xfxfh

xfxfh

xfxfhI

where there are n equally spaced base points.

n

n

x

x

x

x

x

x

dxxfdxxfdxxfI1

3

2

2

)()()(1

Page 9: Lecture 8. Integration Indefinite Integrals Indefinite Integrals of a function are functions that differ from each other by a constant. Definite Integrals
Page 10: Lecture 8. Integration Indefinite Integrals Indefinite Integrals of a function are functions that differ from each other by a constant. Definite Integrals

Error Estimate in the trapezoidal rule

It can be obtained by integrating the interpolation error we defined in previous chapter for Lagrange polynomial as

0

1

2

3

4

5

0 5 10

x

f(x)

Error

Page 11: Lecture 8. Integration Indefinite Integrals Indefinite Integrals of a function are functions that differ from each other by a constant. Definite Integrals

Example

)(''max12 ],[

2 xfhab

Errorbax

5

010

2

1 error ,)sin( thatsohfinddxx

52 102

1

121)('' hErrorxf

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

52 106

h

Page 12: Lecture 8. Integration Indefinite Integrals Indefinite Integrals of a function are functions that differ from each other by a constant. Definite Integrals

0 1

Page 13: Lecture 8. Integration Indefinite Integrals Indefinite Integrals of a function are functions that differ from each other by a constant. Definite Integrals

0 11/2

1 12

0 11/21/4 3/4

1 12 2 2

Page 14: Lecture 8. Integration Indefinite Integrals Indefinite Integrals of a function are functions that differ from each other by a constant. Definite Integrals

Remark 1: in this example instead of re-computation of some function values when h is changed to h/2 we observe that

Page 15: Lecture 8. Integration Indefinite Integrals Indefinite Integrals of a function are functions that differ from each other by a constant. Definite Integrals

Simpson’s Rules

0

1

2

3

4

5

0 5 10

x

f(x)

Simpson’s 1/3 rule can be obtained by passing a parabolic interpolant through three adjacent nodes.

The area under the parabola is

Page 16: Lecture 8. Integration Indefinite Integrals Indefinite Integrals of a function are functions that differ from each other by a constant. Definite Integrals

To obtain the total area of (n-1) even intervals we apply the following general Simpson’s 1/3 rule

f(x1), f(xn)Note:

1

f(x2), f(x4), f(x6),..

4f(x3), f(x5), f(x7),..

2

Page 17: Lecture 8. Integration Indefinite Integrals Indefinite Integrals of a function are functions that differ from each other by a constant. Definite Integrals

Remark 2: Simpson’s 1/3 rule requires the number of intervals to be even. If this condition is not satisfied, we can integrate over the first (or last) three intervals with Simpson’s 3/8 rule which can be obtained by passing a cubic interpolant through four adjacent nodes, and defined by

The error in the Simpson’s rule is

Page 18: Lecture 8. Integration Indefinite Integrals Indefinite Integrals of a function are functions that differ from each other by a constant. Definite Integrals

Because the number of panels is odd, we compute the integral over the first three intervals by Simpson’s 3/8 rule, and use the 1/3 rule for the last two intervals:

Simpson’s 3/8 rule Simpson’s 1/3 rule

Page 19: Lecture 8. Integration Indefinite Integrals Indefinite Integrals of a function are functions that differ from each other by a constant. Definite Integrals
Page 20: Lecture 8. Integration Indefinite Integrals Indefinite Integrals of a function are functions that differ from each other by a constant. Definite Integrals
Page 21: Lecture 8. Integration Indefinite Integrals Indefinite Integrals of a function are functions that differ from each other by a constant. Definite Integrals
Page 22: Lecture 8. Integration Indefinite Integrals Indefinite Integrals of a function are functions that differ from each other by a constant. Definite Integrals

Summary

Newton Cotes formulae for Numerical

integration.

Trapezoidal Rule

Simpson’s Rules.

Romberg Integration

Double Integrals

To be continued in

Lecture 9