• Non ci sono risultati.

Lecture on Numerical Analysis

N/A
N/A
Protected

Academic year: 2021

Condividi "Lecture on Numerical Analysis"

Copied!
12
0
0

Testo completo

(1)

M. Dumbser

Lecture on Numerical Analysis

Dr.-Ing. Michael Dumbser

15 / 09 / 2008

(2)

Interpolation

x

0

x

1

x

2

x

3

f

0

f

1

f

2

f

3

x f

x

•Set of given function values at given points. These may come e.g. from measurements made in the real world (temperature, snow thickness, rainfall) or may come from laboratory experiments.

• Interpolating function p

n

(x) (usually a polynomial)

• Interpolated function value

p

n

(x)

(3)

M. Dumbser 3 / 9

Polynomial Interpolation

The interpolation polynomial p

n

(x) must satisfy the following properties:

(1) p

n

(x) is from the space P

n

of polynomials with maximal degree n (2) p

n

(x

i

)=f

i

.

1. Direct approach: p

n

(x) = a

0

+ a

1

x + a

2

x

2

+ a

3

x

3

+ … + a

n

x

n

=  a

j

x

j.

This satisfies (1).

Using (2) leads to a linear equation system to be solved for the a

i

2. Lagrange interpolation: p

n

(x) =  f

j

L

j

(x) with the special Lagrangian interpolation polynomials

No linear equation system must be solved (formally, the matrix of the

corresponding linear system is the identity matrix, so one obtains directly a

i

=f

i

).

3. Newton interpolation:

p

n

(x) = a

0

+ a

1

(x-x

0

) + a

2

(x-x

0

)(x-x

1

) + … + a

n

(x-x

0

)(x-x

1

)…(x-x

n-1

)

The system matrix is a lower triangular matrix, which means the linear system for the a can be solved very efficiently.

  

  

 

 

n

j

j

k

k j

n x a x x

p

0

1

0

) (

) (

        

i  i   i i i  i i i   i n n  i n n

i x x x x x x x x x x x x

x x x

x x

x x

x x

x x x x

L      

 

1 1

1 1

0

1 1

1 1

) 0

(  

(4)

Joseph-Louis Lagrange

Joseph-Louis Lagrange o Giuseppe Ludovico Lagrangia (* 25. January 1736 in Torino; † 10. April 1813 in Paris)

• Father (with French origin) wanted him to study law

• Lagrange learnt on his own in only one year all the knowledge about mathematics available at that time.

• With 19 professor at the Royal School of Artillery in Torino

• 1766 director of the Prussian Academy of Sciences Successor of Leonhard Euler in Berlin

• 1788 publication of the famous „Mécanique analytique“

• From 1797 professor at the Ecole Polytechnique in Paris

• Buried in the pantheon in Paris

(5)

M. Dumbser

Approximation Error of Polynomial Interpolation

Suppose there exists a so-called generating function f(x) which is (n+1)-times differentiable for which the function values f

i

to be interpolated by the interpolation polynomial p

n

(x) satisfy

(1) f(x

i

)=f

i

.

)!

1 (

)) ( ) (

( )

( )

(

) 1 (

 

n

x x f

x p x

f

n n

 

Then the approximation error f(x) - p

n

(x) made by the interpolation polynomial p

n

(x) is given by:

 

n

j

x j

x x

0

) (

)

 (

Where is a value from the smallest interval I=[x

0

,x

1

,…,x

n

,x] containing all x

i

and x.

Remarks:

• The value for depends on the position x.

• For values of x that are not contained in the interval [x

0

,x

1

,…x

n

], i.e. for extrapolation problems, the error grows very quickly. This can be verified quickly looking at (x).

• The interpolation error is connected to the (n+1)-th derivative of the

generating function f(x)

(6)

Problems with Polynomial Interpolation

For general functions f(x) the accuracy of polynomial interpolation does not increase when increasing the degree of the interpolation polynomial. It may even happen that the error increases considerably when increasing the polynomial degree.

Example of Carl Runge: Polynomial interpolation of 2

25 1

) 1

( x x

f  

polynomial degree n = 4

polynomial degree n = 8

polynomial degree n = 12

Observation: increaslingly severe oscillations of the interpolation

polynomial at the boundaries of the interpolation interval.

1 , 1

x

(7)

M. Dumbser

Spline Interpolation

Motivated by the problems arising with very high order polynomial interpolation,

engineers and mathematicians developed the concept of spline interpolation. The key idea hereby is, to use piecewise polynomials defined on sub-intervals. The piecewise polynomials are connected to each other in such a manner that the function value and the first two derivatives are continuous.

Typically, cubic splines are used, consisting of piecewise polynomials of degree three.

Definition of a cubic spline interpolant on the interval I=[a,b]:

i n S i x

x S

1

) ( )

(

) ( )

(

) ( )

(

] , [

if 0 ) (

) ( ,

) (

) (

'' 1 ''

' 1 '

1 1

1 3

i i

i i

i i

i i

i i

i

i i

i i

i i i

x S

x S

x S

x S

x x

x x

S

f x

S f

x S

P x

S

Usually, the following boundary conditions are enforced:

0 ) ( )

( ''

'' aS b

S

(8)

Spline Interpolation

x

0

x

2

x

n-1

x

n

x f

x

1

x

i-1

x

i

i

S

i

(x)

S

i+1

(x) S

i-1

(x)

Historically, numerical spline interpolation was first developed by engineers. It was inspired by a tool commonly used in naval engineering. The tool consists in a bar that was fixed on the given points by nails and which then bends (deforms) according to these boundary conditions.

In fact, this property of the bar is mathematically mimicked by the spline

interpolation functions via the so-called minimum norm property.

(9)

M. Dumbser

Spline Interpolation

Theorem 1:

    



 

 

 

 

n

i

x x b

a f x S x S x

ii

x S x S x

f S

f S

f

1 2

2 2

)

1

( )) ( )

( ( )

( )) ( )

( ( 2

We define a measure for the total bending (curvature) of a two-times differentiable function f(x) as follows:

0 ) ( )

(   

 a S b S

 

b

a

dx x

f

f 2 '' ( ) 2

Theorem 2:

2

2 f

S

Using the natural boundary conditions and the other properties of the spline function, we immediately obtain the minimum norm property:

The proofs for both theorems are shown on the blackboard and are recommended

as an exercise at home.

(10)

Spline Interpolation

Theorem 1:

    



 

 

 

 

n

i

x x b

a f x S x S x

ii

x S x S x

f S

f S

f

1 2

2 2

)

1

( )) ( )

( ( )

( )) ( )

( ( 2

We define a measure for the total bending (curvature) of a two-times differentiable function f(x):

0 ) ( )

(   

 a S b S

 

b

a

dx x

f

f 2 '' ( ) 2

Theorem 2:

2

2 f

S

Using the natural boundary conditions and the other properties of the spline function, we immediately obtain the minimum norm property:

The proofs are shown on the blackboard and are recommended as an exercise at

home.

(11)

M. Dumbser

Spline Interpolation

Finally, with the method of moments, we obtain the following expression for the natural cubic spline:

0 )

( )

(  1    1

 a M S b M N S

    iii

i i i

i i i

i A x x B

h x M x

h x M x

x

S      

6 ) 6

(

3 1 3

1

with

 

1 6

1 i

i i

i i i i

M h h M

f

A f   

6

2 i i i

i

M h f

B  

1 1 1 1

1 1 1

6 3

6

 

 

 

 

 

 

  

i i i

i i i

i i i

i i i i

h f f

h f f

M h h

M h M h

Recall that the boundary conditions for the natural cubic spline are:

i i

i x x

h1

(12)

Polynomial Interpolation Exercise

1. Write a Maple worksheet that interpolates a set of n+1 points (x

i

,f

i

) using the polynomial interpolation of Lagrange.

2. Apply the method to the function

3. Apply the method to the function

4. Discuss the results

25 2

1 ) 1

( x x

f   x 1 , 1

) exp(

)

( x x

f   x   0 , 2

Riferimenti

Documenti correlati

In § 6 we give three examples: (i) the HOMFLYPT ability to detect the presence of zero-linking number structures (such as a system of unlinked vortex rings), that otherwise would

SIAM Conference on Mathematical and Computational Issues in the Geosciences (SIAM GS13) Padova (Italy) June 17-20 2013M. Polynomial interpolation and quadrature on subregions of

Keywords: Weakly Admissible Meshes, Discrete Extremal Sets, Approximate Fekete Points, Discrete Leja Points, Polynomial Interpolation, Algebraic Cubature, Quadran- gles,

Since we use here for the first time algorithm AFP for the construction of polynomial filters based on interpolation at approximate Fekete points, we begin by a simple nonweighted

On the base of these and several other numerical tests with spherical triangles of different size and functions of different regularity, we are confident that the proposed

Figure 3: Behavior of the error with respect to the degree of interpolation in the Leja stabilization procedure for the interpolation of the Runge function at an initial set of

In [1] we gave an efficient implementation of the Xu interpolation formula and we studied numerically its Lebesgue constant, giving evidence that it grows like O((log n) 2 ), n

Find the coefficients of the polynomial interpolating x = (−2, 1, 3) and y = (−2, 11, 17) via the polyfit command on a script named. Esercizio2 and