inhalt kapitel iv: interpolation - webhome · pdf fileprof. dr. barbara wohlmuth lehrstuhl...

32

Upload: ngothuan

Post on 06-Feb-2018

220 views

Category:

Documents


0 download

TRANSCRIPT

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Inhalt Kapitel IV: Interpolation

IV Interpolation

IV.1 Polynom-Interpolation

IV.2 Spline-Interpolation

Kapitel IV (InhaltIV) 1

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Die Interpolationsformel von Lagrange

Zentrale Aussage: Zu beliebigen n + 1 Stutzpunkten (xi, fi), i = 0, . . . , n mitpaarweise verschiedenen Stutzstellen xi 6= xj, fur i 6= j, gibt es genau ein Polynomπn ∈ Pn mit

πn(xi) = fi, i = 0, . . . , n.

Es gilt

πn(x) =n∑

i=0

fiLi(x)

mit den Interpolationspolynomen

Li(x) :=∏

k 6=i

x− xk

xi − xk, i = 0, . . . , n.

Kapitel IV (interpol02) 2

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Die Interpolationsformel von Lagrange, Beispiel

Gegeben seien fur n = 2 :

i 0 1 2xi 0 1 3fi 1 3 2

Als Interpolationspolynome ergeben sich

L0(x) =(x− 1)(x− 3)

(0− 1)(0− 3), L1(x) =

(x− 0)(x− 3)

(1− 0)(1− 3), L2(x) =

(x− 0)(x− 1)

(3− 0)(3− 1),

und damit

π2(x) = 1 · L0(x) + 3 · L1(x) + 2 · L2(x)

=1

6(−5x2 + 17x+ 6)

-6

-5

-4

-3

-2

-1

0

1

2

3

4

-1 0 1 2 3 4

P(x)1L0(x)3L1(x)2L2(x)

Stuetzstellen

Kapitel IV (interpol03) 3

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Die Interpolationsformel von Lagrange

Beispiel: Exponentialfunktion

Gegeben seien fur n = 2 :

i 0 1 2xi −1 0 1fi e−1 e0 e1

Als Interpolationspolynome ergeben sich

L0(x) =(x − 0)(x − 1)

(−1 − 1)(−1 − 0), L1(x) =

(x + 1)(x − 1)

(0 + 1)(0 − 1), L2(x) =

(x + 1)(x − 0)

(1 + 1)(1 − 0),

und damit

π2(x) = e−1 · L0(x) + e0 · L1(x) + e1 · L2(x)

= e−1 ·1

2(x2 − x)− 1 · (x2 − 1) + e ·

1

2(x2 + x)

=

(

1

2e− 1 +

e

2

)

x2 +

(

e

2−

1

2e

)

x+ 1

= (cosh(1)− 1)x2 + sinh(1)x+ 1

Kapitel IV (interpol03a) 4

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Die Interpolationsformel von Lagrange

Beispiel: Exponentialfunktion

−2 −1 0 1 2−2

−1

0

1

2

3

4 L0(x)

L1(x)

L2(x)

Stützpunkte

−2 −1 0 1 2

0

2

4

6

8 Π2(x)

ex

e−1*L0(x)

e0*L1(x)

e1*L2(x)

Stützstellen

Kapitel IV (interpol04a) 5

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Interpolationsfehler

Die Stutzwerte fi stammen oft von einer stetigen Funktion f , d.h.

fi = f(xi), i = 0, . . . , n.

Gilt {xi : i = 0, . . . , n} ⊂ [a, b], so lasst sich der Fehler f − πn in derMaximumsnorm

‖f‖[a,b] := ‖f‖L∞([a,b]) := maxx∈[a,b]

|f(x)|

abschatzen als

‖f − πn‖[a,b] ≤‖ωn+1‖[a,b](n+ 1)!

‖f (n+1)‖[a,b].

Hierbei ist

ωn+1(x) :=n∏

i=0

(x− xi).

Der Ausdruck ‖ωn+1‖[a,b] hangt alleine von der Wahl der Stutzstellen ab.

Kapitel IV (interpol11) 6

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Das Polynom ωn+1

Aquidistante Stutzstellen, n = 21

−1 −0.5 0 0.5 1−20

−15

−10

−5

0

5x 10−5

Frage: Gibt es eine Knotenverteilung, so dass ‖ωn+1‖[a,b] minimal wird?

Kapitel IV (interpol12) 7

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Das Polynom ωn+1

Aquidistant, weitere Stutzstellen, Tschebyscheff, n = 21

−1 −0.5 0 0.5 1−20

−10

0

x 10−5

−1 −0.5 0 0.5 1−1000

0

1000

2000

3000

4000

5000

−1 −0.5 0 0.5 1−0.02

0

0.02

0.04

0.06

0.08

−1 −0.5 0 0.5 1−15

−10

−5

0

5x 10−4

−1 −0.5 0 0.5 1−20

−15

−10

−5

0

5x 10−6

−1 −0.5 0 0.5 1−5

0

5x 10−7

Die sog. Tschebyscheffpunkte liefern ein optimales ‖ωn+1‖[a,b].

Kapitel IV (interpol12a) 8

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Tschebyscheff–Interpolation

Fur n ∈ N0 bezeichne Tn das Tschebyscheffpolynom,

Tn(x) := cos(n arccosx), x ∈ [−1, 1].

Es gilt die 3-Term Rekursion

T0(x) = 1, T1(x) = x,

Tn(x) = 2xTn−1(x)− Tn−2(x), n ≥ 2,

=⇒ Tn ∈ Pn

Nullstellen von Tn sind die Tschebyscheffpunkte

x(n+1)i = cos

(

2i+ 1

2n+ 2π

)

, i = 0, . . . , n.

Kapitel IV (interpol13) 9

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Tschebyscheffpolynome

-1

-0.5

0

0.5

1

-1 -0.5 0 0.5 1

T0(x)T1(x)

T2(x)T3(x)

T4(x)T5(x)

Kapitel IV (interpol16) 10

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Tschebyscheffpunkte

n = 3

45

n = 5

30

20

n = 8 n=17

10

Kapitel IV (interpol14) 11

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Aquidistante Punkte vs. Tschebyscheffpunkte

−1 −0.5 0 0.5 1−0.5

0

0.5

1

1.5

2

2.5

3n = 19, Lagrange Polynom L

9(x)

‖L9,aquidistant‖[−1,1] = 1.0 · 103, ‖L9,Tschebyscheff‖[−1,1] = 1.0

Kapitel IV (interpol17) 12

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Aquidistante Punkte vs. Tschebyscheffpunkte

f(x) = 1/(1 + 25x2)

−1 0 1

−0.20

0.20.40.60.8

n = 4

−1 0 1

0

0.2

0.4

0.6

0.8

n = 6

−1 0 1−1

−0.5

0

0.5

n = 8

−1 0 1

0

0.5

1

1.5

n = 10

−1 0 1

−3

−2

−1

0

n = 12

−1 0 1

0

2

4

6

n = 14

, Tschebyscheffpunkte:Konvergenz

/ Aquidistante Punkte:Randoszillationen

Kapitel IV (interpol18) 13

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Aquidistante Punkte vs. Tschebyscheffpunkte

Interpolationsfehler, f(x) = 1/(1 + 25x2)

−1 0 1

−1.5

−1

−0.5

0

n = 10, aequidistant

−1 0 1−0.1

−0.05

0

0.05

n = 10, Tschebyscheff

−1 0 1

0

10

20

30

40

50

n = 20, aequidistant

−1 0 1

−0.01

−0.005

0

0.005

0.01

0.015

n = 20, Tschebyscheff

−1 0 1

−2000

−1500

−1000

−500

0

n = 30, aequidistant

−1 0 1−2

−1

0

1

2x 10

−3

n = 30, Tschebyscheff

Kapitel IV (interpol19) 14

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Interpolationsfehler und Lebesgue Konstanten Λn

Definiton Lebesgue Konstante Λn:

Λn := maxx∈[−1,1]

n∑

i=0

|Li(x)|

Interpolationsfehler:

‖f −Πnf‖[−1,1] ≤ CΛnω(f,1

n)

Hierbei bezeichnen Li die Lagrange-Interpolationspolynome, und ω(f, 1n) denStetigkeitsmodul von f . Dieser ist definiert als

ω(f, δ) := sup|x−y|<δ

|f(x)− f(y)|

mit ω(f, 1n) ≤Ln falls f Lipschitz-stetig hinsichtlich der Konstanten L ist.

Kapitel IV (interpol20c) 15

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Verhalten der Lebesgue-Konstanten fur steigende

Polynomordnung

Aquidistant vs. Tschebyscheff

0 10 20 3010

0

105

1010

Lebesgue−Konstante

Anzahl Stützstellen

äquidistantTschebyscheff

0 10 20 30

100.3

100.4

100.5

Lebesgue−Konstante

Anzahl Stützstellen

Tschebyscheff(2/π)*log(n+1)+1

, Λn wachst logarithmisch fur Tschebyscheffpunkte: Λn ≤ 2π ln(n+ 1) + 1,

/ Λn wachst exponentiell fur aquidistante Punkte: Λn ≥ Cen/2.

Kapitel IV (interpol15b) 16

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Konvergenzverhalten fur Tschebyscheffpunkte

Interpolationsfehler ‖f(x)−Πn(x)‖[−1,1]

0 500 100010

−15

10−10

10−5

100

Fehler (logarithmisch)

Anzahl Stützstellen

1/(1+25x2)

|x|3/2

|x|1/2

Interpolationsfehler hangt vom Stetigkeitsmodul ω(f, 1n) des Interpolanden ab.

Kapitel IV (interpol20d) 17

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Auswertung des Interpolationspolynoms

Ziel: Πn(f, y) soll fur. . .

• k verschiedene Funktionen f

• an jeweils m weiteren Stellen yi, i = 1 . . .m

ausgewertet werden.

Dazu gibt es folgende Moglichkeiten:

Aitken-Neville Newton & Horner baryzentrisch

Aufwand O(kmn2) O(kmn+ kn2) O(kmn+ n2)

Stabilitat , / ,

Kapitel IV (interpol78) 18

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Das Schema von Aitken und Neville

Das gesuchte Polynom πn soll an einem Punkt x ausgewertet werden. Fur k + 1paarweise verschiedene Indizes {i0, . . . , ik} ⊂ {0, . . . , n} bezeichne Pi0...ik ∈ Pk

das Interpolationspolynom durch (xi0, fi0), . . . , (xik, fik). Es gilt:

Pi(x) = fi, i = 0, . . . , n,

Pi0...ik(x) =(x− xi0)Pi1...ik(x)− (x− xik)Pi0...ik−1

(x)

xik − xi0

.

Neville–Schema fur n = 2:

k = 0 1 2

x0 f0 = P0(x)

P01(x)

x1 f1 = P1(x) P012(x)

P12(x)

x2 f2 = P2(x)

Kapitel IV (interpol05) 19

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Das Schema von Aitken und Neville, Beispiel

Gegeben seien fur n = 2 :

i 0 1 2xi 0 1 3fi 1 3 2

Neville–Schema fur die Berechnung von π2(2) = P012(2):

k = 0 1 2

x0 = 0 P0(2) = 1

P01(2) = (2−0)·3−(2−1)·11−0 = 5

x1 = 1 P1(2) = 3 P012(2) = (2−0)·5/2−(2−3)·53−0 = 10/3

P12(2) = (2−1)·2−(2−3)·33−1 = 5/2

x2 = 3 P2(2) = 2

Kapitel IV (interpol06) 20

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Das Schema von Aitken und Neville

Einfache Erweiterung um zusatzliche Punkte

zusatzliches Wertepaar (x3, f3) := (4, 3), berechne π3(2) = P0123(2):

k = 0 1 2 3

x0 = 0 P0(2) = 1

P01(2) = 5

x1 = 1 P1(2) = 3 P012(2) = 10/3

P12(2) = 5/2 P0123(2) = 8/3

x2 = 3 P2(2) = 2 P123(2) = 2

P23(2) = 1

x3 = 4 P3(2) = 3

Kapitel IV (interpol07) 21

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Die Newtonsche Interpolationsformel

Idee: Darstellung des gesuchten Polynoms πn als

πn(x) = c0 + c1(x− x0) + c2(x− x0)(x− x1) + . . .+ cn(x− x0) · · · (x− xn−1)

=n∑

i=0

ci

i−1∏

k=0

(x− xk).

Bestimmung der Koeffizienten ci, i = 0, . . . , n durch

f0 = πn(x0) = c0

f1 = πn(x1) = c0 + c1(x1 − x0)

...

fn = πn(xn) = c0 + c1(xn − x0) + . . .+ cn

n−1∏

k=0

(xn − xk)

Kapitel IV (interpol08) 22

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Newtonsche dividierte Differenzen

Beobachtung: Pi0...ik − Pi0...ik−1∈ Pk mit Nullstellen xi0, . . . , xik−1

,mit fi0...ik werde der fuhrende Koeffizient bezeichnet.Es gilt

f0...i = ci, i = 0, . . . , n,

und die Rekursionsformel

fi0...ik =fi1...ik − fi0...ik−1

xik − xi0

.

Differenzen–Schema fur n = 2:

k = 0 1 2

x0 f0f01

x1 f1 f012f12

x2 f2

Kapitel IV (interpol09) 23

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Newtonsche dividierte Differenzen, Beispiel

Gegeben seien fur n = 2 :i 0 1 2

xi 0 1 3

fi 1 3 2

Differenzen–Schema:

k = 0 1 2

x0 = 0 f0 = 1

f01 = 3−11−0 = 2

x1 = 1 f1 = 3 f012 = −1/2−23−0 = −5/6

f12 = 2−33−1 = −1/2

x2 = 3 f2 = 2

Auswertung mit dem Horner–Schema:

π3(x) = f0 + (x− x0) [f01 + (x− x1)f012]

Kapitel IV (interpol10) 24

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Baryzentrische Interpolationsformel

Πn(x) =n∑

i=0

fiLi(x) mit Li(x) :=∏

k 6=i

x− xk

xi − xk, i = 0, . . . , n.

lasst sich wie folgt umschreiben:

Πn(x) =

∑ni=0

βix−xi

fi∑n

i=0βi

x−xi

mit βi :=1

k 6=i (xi − xk), i = 0, . . . , n.

Kapitel IV (interpol79) 25

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Baryzentrische Interpolationsformel

Vorteile:

• Berechnung der βi mit O(n2) Rechenoperationen

• βi sind unabhangig von den fi

• eine weitere Stutzstelle lasst sich mit einem zusatzlichen Aufwand von O(n)Rechenoperationen aufnehmen

• stabile Berechnung der Gewichte βi

• βi sind analytisch bekannt fur Tschebyscheff und aquidistante Knoten

Kapitel IV (interpol79) 26

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Horner-Schema Interpolationsfehler, f(x) = 1/(1 + 25x2)

−1 −0.5 0 0.5 10

0.2

0.4

0.6

0.8

1Div. Diff. und Horner

π50

(x)

f(x)

−1 −0.5 0 0.5 1−1

−0.5

0

0.5

1Div. Diff. und Horner

π60

(x)

f(x)

−1 −0.5 0 0.5 1−800

−600

−400

−200

0

200

400

600Div. Diff. und Horner

π70

(x)

f(x)

−1 −0.5 0 0.5 1−2

−1

0

1

2

3

4

5x 10

5 Div. Diff. und Horner

π80

(x)

f(x)

−1 −0.5 0 0.5 1−5

0

5

10

15

20x 10

9 Div. Diff. und Horner

π90

(x)

f(x)

−1 −0.5 0 0.5 1−8

−6

−4

−2

0

2

4

6

8x 10

14 Div. Diff. und Horner

π100

(x)

f(x)

Kapitel IV (interpol73a) 27

Prof. Dr. Barbara Wohlmuth

Lehrstuhl fur Numerische Mathematik

Vergleich Interpolationsfehler, f(x) = 1/(1 + 25x2)

−1 −0.5 0 0.5 10

0.2

0.4

0.6

0.8

1Aitken−Neville

π40

(x)

f(x)

−1 −0.5 0 0.5 10

0.2

0.4

0.6

0.8

1Div. Diff. und Horner

π40

(x)

f(x)

−1 −0.5 0 0.5 10

0.2

0.4

0.6

0.8

1Baryzentrische Darstellung

π40

(x)

f(x)

−1 −0.5 0 0.5 10

0.2

0.4

0.6

0.8

1Aitken−Neville

π100

(x)

f(x)

−1 −0.5 0 0.5 1−8

−6

−4

−2

0

2

4

6

8x 10

14 Div. Diff. und Horner

π100

(x)

f(x)

−1 −0.5 0 0.5 10

0.2

0.4

0.6

0.8

1Baryzentrische Darstellung

π100

(x)

f(x)

Kapitel IV (interpol72) 28