lecture on numerical analysis

18
M. Dumbser 1 / 18 Analisi Numerica Università degli Studi di Trento Dipartimento d‘Ingegneria Civile ed Ambientale Dr.-Ing. Michael Dumbser Lecture on Numerical Analysis Dr.-Ing. Michael Dumbser 24 / 09 / 2008

Upload: temira

Post on 25-Feb-2016

79 views

Category:

Documents


3 download

DESCRIPTION

Lecture on Numerical Analysis. Dr.-Ing. Michael Dumbser . 24 / 09 / 2008. Numerical Integration (Quadrature) of Functions - Motivation. Task: compute approximately . f. Solution strategy:. Divide interval [ a;b ] into n smaller subintervals - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Lecture on Numerical Analysis

M. Dumbser1 / 18

Analisi NumericaUniversità degli Studi di TrentoDipartimento d‘Ingegneria Civile ed AmbientaleDr.-Ing. Michael Dumbser

Lecture on Numerical Analysis

Dr.-Ing. Michael Dumbser

24 / 09 / 2008

Page 2: Lecture on Numerical Analysis

M. Dumbser2 / 18

Analisi NumericaUniversità degli Studi di TrentoDipartimento d‘Ingegneria Civile ed AmbientaleDr.-Ing. Michael Dumbser

Numerical Integration (Quadrature) of Functions - Motivation

a b x

f

b

a

n

ii

n

i

x

x

dhxfhdxxfdxxfi

i1

1

01

)()()(1

b

a

dxxf ?)(

h

nabh

hiaxi

Task: compute approximately

Solution strategy:• Divide interval [a;b] into n smaller subintervals

• Approximate f(x) by interpolation polynomials on the subintervals, e.g. using Lagrange interpolation

• Integrate these polynomials exactly on each subinterval and sum up

• So-called Newton-Cotes formulae

ni ,...1,0

Page 3: Lecture on Numerical Analysis

M. Dumbser3 / 18

Analisi NumericaUniversità degli Studi di TrentoDipartimento d‘Ingegneria Civile ed AmbientaleDr.-Ing. Michael Dumbser

Transformation of the Integration Interval

1

0

1

0

)(~:)()(1

dfhdhxfhdxxf i

x

x

i

i

The computation of numerical quadrature formulae for each sub-interval can be technically considerably simplified using the following variable substitution:

hxx i ii xxh 1 hddx

Therefore, it is sufficient, without the loss of generality, to consider from now on the case of numerical integration in the reference interval [0;1].

...)(~1

0

df

Page 4: Lecture on Numerical Analysis

M. Dumbser4 / 18

Analisi NumericaUniversità degli Studi di TrentoDipartimento d‘Ingegneria Civile ed AmbientaleDr.-Ing. Michael Dumbser

The Newton-Cotes Formulae

The integral of f(x) is approximated in the following steps:

1. First, the function f(x) is interpolated by a polynomial of degree k insideeach sub-interval. The interpolation points are distributed in an equidistantmanner in each sub-interval.

2. Second, the interpolation polynomial is integrated analytically.

3. Steps 1 and 2 produce an approximation of the integral of f(x) in termsof the function values fi at the interpolation points and the step size h.

Page 5: Lecture on Numerical Analysis

M. Dumbser5 / 18

Analisi NumericaUniversità degli Studi di TrentoDipartimento d‘Ingegneria Civile ed AmbientaleDr.-Ing. Michael Dumbser

The Trapezium or Trapezoid Rule

a b

f

hnabh

hiaxi 1

Use linear interpolation polynomials, i.e. polynomials of degree one in the subintervals [xi;xi+1] [0;1]:

010

101

11

ii ffPf

1

1

01 2

121

ii ffdP

11 2

1

ii

x

x

ffhdxxPi

i

x

11 1 ii ffP

Page 6: Lecture on Numerical Analysis

M. Dumbser6 / 18

Analisi NumericaUniversità degli Studi di TrentoDipartimento d‘Ingegneria Civile ed AmbientaleDr.-Ing. Michael Dumbser

The Simpson Rule (Originally Discovered by Johannes Kepler in 1615)

a b

f

hnabh

hiaxi 1

Use quadratic interpolation polynomials, i.e. polynomials of degree two:

2

121

121

21

2121

2

1010

1010

1001

21

ii

i

ff

fPf

1

1

02 6

132

61

21 iii fffdP 12

21

1

46

iii

x

x

fffhdxxPi

i

x

2

12

22

24

132

21 ii

i

ff

fP

Page 7: Lecture on Numerical Analysis

M. Dumbser7 / 18

Analisi NumericaUniversità degli Studi di TrentoDipartimento d‘Ingegneria Civile ed AmbientaleDr.-Ing. Michael Dumbser

The 3/8 Rule

Use cubic interpolation polynomials, i.e. polynomials of degree three:

3

231

32

31

132

31

32

32

31

31

32

31

31

32

32

31

32

31

3

11010

1010

1010

10001

32

31

ii

ii

ff

ffPf

1

1

03 8

183

83

81

32

31 iiii ffffdP

3223

129

312

343

227

322

353

227

92

91123

29

3

32

312

ii

ii

ff

ffP

Page 8: Lecture on Numerical Analysis

M. Dumbser8 / 18

Analisi NumericaUniversità degli Studi di TrentoDipartimento d‘Ingegneria Civile ed AmbientaleDr.-Ing. Michael Dumbser

Isaac Newton

Sir Isaac Newton - (* 4. January 1643 in Woolsthorpe; † 31. March 1727 in Kensington)

• Physicist, Mathematician, Astronomer and Philosopher

• Together with Leibniz, Newton is one of the inventors of infinitesimal calculus (differentiation and integration)

• 1667: Fellow of Trinity College, Cambridge

• 1687: Philosophiae Naturalis Principia Mathematica. Newton discovered the universal law of gravitation and the laws of motion of classical mechanics

• 1704: Opticks. A corpuscular theory of light.

• From 1703 president of the Royal Society

• Buried in Westminster abbey in London

Page 9: Lecture on Numerical Analysis

M. Dumbser9 / 18

Analisi NumericaUniversità degli Studi di TrentoDipartimento d‘Ingegneria Civile ed AmbientaleDr.-Ing. Michael Dumbser

The Gaussian Quadrature Formulae The previously derived formulae were all of the form

and were very easy to obtain since an equidistant spacing of the nodes was imposed and only the weights j had to be computed. The aim of the Gaussian quadrature formulae is now to obtain an optimal quadrature formula with a given number of points by making also the nodes an unknown in the derivation procedure of the quadrature formula and to come up with an optimal set of nodes xj and weights wj.

An explicit construction strategy for Gaussian integration formulae:

(1) Using M quadrature points, we have M unknowns for the positions and also M unknowns for the weights, i.e. a total of 2M unknowns.

(2) We need 2M equations to determine uniquely the 2M unknowns.

(3) The equations are obtained by requiring that the integration formula is exact for polynomials from degree 0 up to degree 2M-1 !

jM

jj fdf

1

1

0 11

Mj

j

Page 10: Lecture on Numerical Analysis

M. Dumbser10 / 18

Analisi NumericaUniversità degli Studi di TrentoDipartimento d‘Ingegneria Civile ed AmbientaleDr.-Ing. Michael Dumbser

The Gaussian Quadrature Formulae This means we have 2M equations of the form to solve for j and j.

For Pi(), any polynomial of degree i can be used, in particular also the monomial i.

ji

M

jji PdP

1

1

0

12...1,0 Mj

Example 1: One integration point, i.e. M = 1, leading to the two equations:

111 101

1

0

1

00

j

M

jjPddP

1111

1

0

1

01 2

1

j

M

jjPddP

11

1121

21,1 11

Page 11: Lecture on Numerical Analysis

M. Dumbser11 / 18

Analisi NumericaUniversità degli Studi di TrentoDipartimento d‘Ingegneria Civile ed AmbientaleDr.-Ing. Michael Dumbser

The Gaussian Quadrature Formulae Example 2: Two integration points, i.e. M = 2, leading to the 4 equations:

21

1

0

11 d

2211

1

0 21 d

361

21,3

61

21,

21

2121

222

211

1

0

2

31 d

322

311

1

0

3

41 d

Page 12: Lecture on Numerical Analysis

M. Dumbser12 / 18

Analisi NumericaUniversità degli Studi di TrentoDipartimento d‘Ingegneria Civile ed AmbientaleDr.-Ing. Michael Dumbser

The Gaussian Quadrature Formulae A more efficient and more general way of obtaining the Gaussian quadrature formulaemakes use of so-called orthogonal polynomials Li(), which are the so-called Legendrepolynomials.

1

0

)()(, dgfgf

The set of polynomials Li() is called orthogonal, if it satisfies the relation

jiji

LLi

ji ifif0

,

First, we define the scalar-product of two functions f and g as follows:

With this scalar product available, we can define the L2 norm of a function f as

fff ,

Page 13: Lecture on Numerical Analysis

M. Dumbser13 / 18

Analisi NumericaUniversità degli Studi di TrentoDipartimento d‘Ingegneria Civile ed AmbientaleDr.-Ing. Michael Dumbser

The Gaussian Quadrature Formulae The polynomials Li() can be constructed via Gram-Schmidt orthogonalization from the monomials M0 = 1, M1 = 2, M3 = 3, … Mn = n as follows:

We first use the analogy of the scalar product of two functions with thescalar product already known for vectors:

i

ii baba, aaa ,

The Gram-Schmidt orthogonalization then proceeds as follows:

00 : LM

1M

0

0

0

01, L

LLLM

0

0

0

0111 ,

LL

LLMML

1M

Page 14: Lecture on Numerical Analysis

M. Dumbser14 / 18

Analisi NumericaUniversità degli Studi di TrentoDipartimento d‘Ingegneria Civile ed AmbientaleDr.-Ing. Michael Dumbser

The Gaussian Quadrature Formulae Instead of performing orthogonalization of vectors, we now perform the orthogonalization of functions as follows:

1:)(0 L

00

01011 ,

,)()(

LLLM

LML

00 LM

1M 1M

00

020

11

12122 ,

,,,

)()(LLLM

LLLLM

LML

00

030

11

131

22

23233 ,

,,,

,,

)()(LLLM

LLLLM

LLLLM

LML

0

0

0

0111 ,

LL

LLMML

0

0

0

01, L

LLLM

Page 15: Lecture on Numerical Analysis

M. Dumbser15 / 18

Analisi NumericaUniversità degli Studi di TrentoDipartimento d‘Ingegneria Civile ed AmbientaleDr.-Ing. Michael Dumbser

The Gaussian Quadrature Formulae Using the orthogonality property of the Legendre polynomials, we find that

else00if1

,1)(1

0

iLdL ii

The Gaussian quadrature formulae are written as

)()(1

1

0j

n

jj fdf

If we now apply formula (2) to the integrals given in (1), we obtain the following linear equation system for the weights j, if we suppose the positions j to be known:

(1)

(2)

else0

0 if1)()(

1

1

0

iLdL ji

n

jji (3)

)(with jiijijijLLeL

(3‘)

Page 16: Lecture on Numerical Analysis

M. Dumbser16 / 18

Analisi NumericaUniversità degli Studi di TrentoDipartimento d‘Ingegneria Civile ed AmbientaleDr.-Ing. Michael Dumbser

The Gaussian Quadrature Formulae Theorem:

If the n positions j are given be the n roots of the polynomial Ln ( Ln( j ) = 0 ), and the weights are given by the solution of system (3), then the Gaussian

quadrature rules are exact for polynomials up to degree 2n-1, i.e.

Proof:

Suppose p() is an arbitrary polynomial of the space of polynomials of degree 2n-1, i.e.

Then we can write the polynomial p() as

12)( nPp

)()()()( rqLp n 1)(),( nPrq

)()(1

0

n

kkkLq )()(

1

0

n

kkkLr

n

jjj pdp

1

1

0

)()(

Page 17: Lecture on Numerical Analysis

M. Dumbser17 / 18

Analisi NumericaUniversità degli Studi di TrentoDipartimento d‘Ingegneria Civile ed AmbientaleDr.-Ing. Michael Dumbser

The Gaussian Quadrature Formulae Proof (continued):

We have

We also have

0

1

0

1

0

,1,)()()()( rqLdrqLdp nn

)()()()(11

jjjn

n

jjj

n

jj rqLp

1

011

)()(n

kjkk

n

jjj

n

jj Lp

01

1

01

)()(

n

jjkj

n

kkj

n

jj Lp

This finishes the proof. QED

Page 18: Lecture on Numerical Analysis

M. Dumbser18 / 18

Analisi NumericaUniversità degli Studi di TrentoDipartimento d‘Ingegneria Civile ed AmbientaleDr.-Ing. Michael Dumbser

Integration of Improper IntegralsIf the integration interval goes to infinity, it can be very useful to change the integration variables use the following substitution:

222

11)(,)(1111)(1

1

1

1

1

1 ttftgdttgdt

ttfdt

ttfdxxf

a

b

a

b

b

a

b

a

2

111tdt

dxx

tt

x

Example:

0

1

0

12

1 11)( dttgdttt

fdxxf

0ab

If the integrand is singular at a known position c, than it is usually useful to split the integral as:

b

c

c

a

b

a

dxxfdxxfdxxf

)()()(

Note: Gaussian quadrature formulae never use the interval endpoints,which makes them very useful for the computation of improper integrals!