• Keine Ergebnisse gefunden

Zusammenfassung Numerische Mathematik Patrik Rohner ::

N/A
N/A
Protected

Academic year: 2021

Aktie "Zusammenfassung Numerische Mathematik Patrik Rohner ::"

Copied!
10
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Zusammenfassung Numerische Mathematik

Patrik Rohner :: <rohnerpa@student.ethz.ch> :: FS’09

1 Grundlagen der Numerik

1.1 Gleitpunktarithmetik

Gleitpunktzahl: x ˆ = σM B

E

σ: Vorzeichen B: Basis M: Mantisse E: Exponent

ˆ F¨ ur die Mantisse M gilt:

M = ∑

lj=1

m

−j

B

−j

0 ≤ m

−j

≤ B − 1 : Ziffern der Mantisse

l : Mantissenl¨ ange (fest)

m

−1

≠ 0 f¨ ur x ˆ ≠ 0 : Normierung

ˆ F¨ ur den Exponenten E gilt:

E = τ ∑

kj=1

e

j

B

k−j

τ : Vorzeichen

0 ≤ e

j

≤ B − 1 : Ziffern des Exponenten k : definierter Exponentenbereich Definition: M (B, l, k) = Menge der Maschinenzahlen

/ M (2,5,3) ⇒ M

max

=

31

32

≈ 1 M

min

=

1

2

E

max/min

= ±7 ˆ

x

max

= M

max

⋅ B

Emax

=

31

32

⋅ 2

7

x ˆ

min

= M

min

⋅ B

Emin

=

1

2

⋅ 2

−7

/ M (B, l, k) ⇒ M

max

=

B

l−1

Bl

M

min

=

1

B

E

max/min

= ±B

k

− 1 ˆ

x

max

=

B

l−1

Bl

⋅ B

Bk−1

ˆ x

min

=

1

B

⋅ B

−(Bk−1)

Definition Maschinengenauigkeit: eps ist die kleinste Zahl, die zu 1 addiert noch eine Ver¨ anderung bewirkt.

∣ x − x ˆ

x ∣ ≤ B

E−L

2B

E−1

=

B

1−L

2 =∶ eps

Pseudo-Arithmetik: (ˆ x + y) ⋅ ˆ z ˆ = z ˆ ⋅ (ˆ y + x) ˆ (ˆ x + y) ⋅ ˆ z ˆ ≠ ˆ x ⋅ ˆ z + ˆ y ⋅ z ˆ (ˆ x + y) + ˆ z ˆ ≠ x ˆ + (ˆ y + z) ⇒ ˆ von klein nach gross summieren

1.2 Fehlerfortpflanzung

Absoluter Fehler: ∆x = x ˆ − x

∆(x ± y) = (ˆ x ± y) − (x ˆ ± y) = ∆x ± ∆y

∆(x ∗ y) = ˆ xˆ y − xy ≅ x∆y + y∆x = xy(δx + δy)

∆(x/y) ≅ x/y(δx − δy) Relativer Fehler: δx =

∆x

x

δ(x ± y) =

∆(x±y)x±y

=

x±yx

∆x

x

±

x±yy

∆y

y

=

x±yx

δx ±

x±yy

δy δ(x ∗ y) =

∆(x∗y)xy

≅ δx + δy

δ(x/y) =

∆(x/y)x/y

≅ δx − δy

Ausl¨ oschung: ∣x ± y∣ ≪ {∣x∣,∣y∣} ⇒ ∣δ(x ± y)∣ ≫ ∣δx∣ + ∣δy∣

Faustregel: wenn δx = 10

−k

, dann sind ≈ k Ziffern richtig.

⇒ besser (x

3

− y

3

)/(x

2

+ xy + y

2

) als x − y rechnen

⇒ besser (x

6

− y

6

)/(x

4

+ x

2

y

2

+ y

4

) als x

2

− y

2

rechnen

1.3 Kondition eines Problems

κ

H

= Konditionszahl = Verst¨ arkungsfaktor des relativen Fehlers von x Konditionszahl κ

H

: δH = ∣

xH

′(x)

H(x)

∣ ∗ ∣δx∣ = κ

H

∗ ∣δx∣

1.3.1 Kondition einer Matrix κ ( A ) = ∣∣ A ∣∣ ⋅ ∣∣ A

−1

∣∣ :

ˆ A ⋅ x ˆ = ˆ b ⇒ ∣∣δx∣∣ ≤ κ(A) ⋅ ∣∣δb∣∣

ˆ A ˆ ⋅ x ˆ = ˆ b ⇒ ∣∣δx∣∣ ≤

1−κ(A)∣∣δA∣∣κ(A)

(∣∣δA∣∣ + ∣∣δb∣∣)

Faustregel: Bei d Dezimalstellen und κ(A) ≅ 10

k

hat die L¨ osung im schlechtesten Fall noch d − k richtige Stellen.

in der 2-Norm: ∣∣A∣∣

2

= √

µ

max

max

= max. EW von A

T

A)

ˆ A orthogonal: A

T

= A

−1

∣∣A∣∣

2

= 1

ˆ A symmetrisch: A

T

= A ∣∣A∣∣

2

= ∣λ

max

∣ ∣∣A

−1

∣∣

2

=

∣λ1

min∣

ˆ A regul¨ ar: ∣∣A

−1

∣∣

2

=

1 µmin

κ(A) =

√ µ

max

√ µ

min

und falls A

T

= A gilt κ(A) = ∣λ

max

∣λ

min

∣ κ ≈ 1 gut konditioniertes Problem κ ≫ 1 schlecht konditioniertes Problem

>> k_A=cond(A)

2 Lineare Gleichungssysteme

2.1 LRP-Zerlegung

LRP-Zerlegung von A aus Ax = b . . . . i LRP-Zerlegung von A: LR = P A >> [L,R,P]=lu(A) ii Vorw¨ artseinsetzen: Lc = P b nach c >> c=L\(P*b) iii R¨ uckw¨ artseinsetzen: Rx = c nach x >> x=R\c Der Algorithmus braucht

23

n

3

+ 2n

2

Operationen. O(n

3

) 2.1.1 Pivotstrategien (gegen Ausl¨ oschung)

ˆ Diagonalstrategie: Diagonalelement = Pivot (schlecht)

ˆ Spaltenmaximumstrategie: Das betragsm¨ assig gr¨ osste Element wird gew¨ ahlt.

ˆ relative Spaltenmaximumstrategie: Das betragsm¨ assig gr¨ osste Element, relativ zum zweitgr¨ ossten Element der Zeile, wird gew¨ ahlt.

2.2 Iterative Methoden

Alle hier ben¨ otigen pro Iterationsschritt grob eine Matrix-Vektor- Multiplikation (O(n

2

), wenn sparse: O(n)) und konvergieren linear (O(n)).

2.2.1 station¨ are Iterationsverfahren x

k+1

= T ⋅ x

k

+ c

Der absolute Fehler ver¨ andert sich mit e

k

= T

k

⋅ e

0

, womit gilt:

Konvergenzbedingung: ∣∣T ∣∣ < 1 >> norm(T)

F¨ ur den Spektralradius ρ(T ) ∶= max ∣λ

i

∣ gilt ρ(T ) ≤ ∣∣T ∣∣ und so alternative Konvergenzbed.: ρ(T ) < 1 >> max(abs(eig(T))) Absch¨ atzung (worst case) der Anzahl Iterationen f¨ ur bestimmte Fehler:

∣∣e∣∣

2

= ∣∣T

k

e

0

∣∣

2

∣∣e

k

∣∣

2

≤ ∣∣T ∣∣

k2

∣∣e

0

∣∣

2 ∣∣e

k∣∣2

∣∣e0∣∣2

≤ ∣∣T ∣∣

k2

k ≥

ln(rel.Fehler) ln∣∣T∣∣2

Aufspaltung f¨ ur bestimmte Verfahren A = L + D + R

>> D=diag(diag(A)) >> L=tril(A)-D >> R=triu(A)-D Jacobi-Verfahren

T = −D

−1

⋅ (L + R) c = D

−1

b

ˆ Konsistenzbedingung: A regul¨ ar, d.h det(A) ≠ 0

ˆ hinreichende Konvergenzbedingung: A strikt diagonal dominant (max

∣.∣ in der Diagonalen)

ˆ notwendige Konvergenzbedingung (bei allen 3 Verfahren): ∣∣T ∣∣ < 1 Gauss-Seidel-Verfahren

T = −(D + L)

−1

R c = (D + L)

−1

b (D + L)x

k+1

= −Rx

k

+ b >> x (k+1)=(D+L)\(-Rx k+b)

Falls A strikt diagonal dominant oder A symmetrisch positiv definit ist, konvergiert das Verfahren, und zwar schneller als das Jacobi-Verfahren.

SOR-Verfahren (Successive Over-Relaxation) x

k+1

= (D + ωL)

−1

[−ωR + (1 − ω)D]

´¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¸¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¶

=T(ω)

x

k

+ (D + ωL)

−1

ωb

´¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¸¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¶

=c(ω)

ω = Relaxationsparameter ω

optimal

=

2

1+√

1−[ρ(D−1(L+R))]2

ρ: Spektralradius

(2)

2.2.2 Methode der konjugierten Gradienten (CG)

ˆ Zu l¨ osendes Gleichungssystem: Ax + b = 0

ˆ Voraussetzungen: A symmetrisch und positiv definit.

F(u) ∶= 1/2u

T

Au + u

T

b gradF =

⎜ ⎜

∂F

∂u1

...

∂F

∂un

⎟ ⎟

= Au + b = r(u) (Residuen) Idee: Anstelle Ax + b = 0 zu l¨ osen, wird das Minimum von F(u) gesucht.

Es gilt F (x) = min

u∈Rn

F (u).

CG-Verfahren Ax + b = 0 . . . .

ˆ Start: u

0

, r

0

= Au

0

+ b, T OL

ˆ 1. Schritt: (Steilster Abstieg) i p

1

= −r

0

ii ρ

1

=

(p(r0,r0)

1,Ap1)

iii u

1

= u

0

+ ρ

1

p

1

iv r

1

= r

0

+ ρ

1

Ap

1

ˆ k. Schritt: (k ≥ 2 , konjugierter Gradient) i e

k−1

=

(r(rk−1,rk−1)

k−2,rk−2)

ii p

k

= −r

k−1

+ e

k−1

p

k−1

iii ρ

k

=

(r(pk−1,rk−1)

k,Apk)

iv u

k

= u

k−1

+ ρ

k

p

k

v r

k

= r

k−1

+ ρ

k

Ap

k

ˆ Abbruchkriterium: ∣∣r

k

∣∣ ≤ T OL∣∣r

0

∣∣

Aufwand: O(n) Iterationen (typisch aber: √

n). Jeder Schritt O(n

2

) Operationen, O(n) bei sparse-Matrix.

Absch¨ atzung /obere Schranke: ∣∣u

k

−x∣∣ ≤ 2α

k

∣∣u

0

−x∣∣ mit α =

√κA−1

√κA+1

/ Gesucht: obere Schranke der Anzahl Iterationen k, um den absoluten Anfangsfehler um den Faktor c zu reduzieren, mit κ

A

gegeben.

k =

ln(0.5⋅c)ln(α)

1

f u n c t i o n[ x , it , t i m e ]= m y _ c g ( A , b , u0 , maxit , tol )

2

tic; % s t a r t m e a s u r i n g t i m e

3

u = u0 ; % s t a r t w i t h i n i t i a l g u e s s

4

r0 = A * u0 + b ;

5

p = - r0 ;

6

r = r0 ;

7

it =0;

8

w h i l e ( it < m a x i t )

9

it = it +1;

10

rho =( r ’* r ) /( p ’*( A * p ) ) ;

11

u = u + rho * p ;

12

r _ o l d = r ;

13

r = r + rho *( A * p ) ;

14

if ( n o r m ( r ) < tol *n o r m ( r0 ) )

15

b r e a k; % c o n v e r g e d

16

end

17

e =( r ’* r ) /( r_old ’* r _ o l d ) ;

18

p = - r + e * p ;

19

end

20

x = u ;

21

t i m e = toc; % s t o p m e a s u r i n g t i m e

22

if ( it == m a x i t )

23

e r r o r ([’ no c o n v e r g e n c e a f t e r ’ , i n t 2 s t r( it ) , ’ i t e r a t i o n s ’]) ;

24

end

>> [x,flag,relres,it]=pcg(A,b,tol,maxit) L¨ ost Ax = b!

Vorkonditionierung: Mit unvollst¨ andiger Cholesky-Zerlegung die Kondition von A verkleinern.

>> H=cholinc(A,1e-3)

>> [x,flag,relres,it]= pcg(A,b,tol,maxit,H’,H)

3 Nichtlineare Gleichungssysteme

3.1 Eine Gleichung in einer Unbekannten

ˆ Gegeben: Stetige Funktion y = f(x).

ˆ Gesucht: L¨ osung x

der Gleichung f(x) = 0 (Nullstelle).

F¨ ur ∣f

(x∗)∣ ≪ 1 ist das Problem schlecht konditioniert:

x∗ = f

−1

(0) = H(0) κ

H

= ∣

H

′(0)

H(0)

∣ = ∣

x∗f1(x∗)

Die Konvergenz der Fixpunkt-Iteration und des Newton-Verfahrens werden mit dem Banachschen Fixpunktsatz untersucht. Sie konvergieren nur wenn der Fixpunktsatz erf¨ ullt ist.

3.1.1 Fixpunkt-Iteration

ˆ Gegeben: y = f (x), x ∈ [a, b]

ˆ Gesucht: L¨ osung der Fixpunktgleichung x = F(x) ⇒ x

k+1

= F (x

k

)

ˆ Abbruchkriterium: ∣x

k+1

− x

k

∣ ≤ ∣x

k+1

∣ ⋅ RT OL + AT OL

Die Fixpunktgleichung erh¨ alt man durch Umformung (Addition, usw.) der Funktionsgleichung f(x) = 0. Die Fixpunktgleichungen sind nicht eindeutig, es gibt meistens mehrere verschiedene Arten die Gleichung darzustellen.

3.1.2 Newton-Verfahren (1D)

ˆ Gegeben: Stetige Funktion y = f(x)

ˆ Gesucht: L¨ osung x

der Gleichung f(x) = 0 (Nullstelle)

ˆ Idee: Ersetze Graph von f(x) durch Tangente in P (x

0

, f(x

0

))

Newton-Iteration in 1D . . . .

ˆ Start: x

0

, f

(x), RT OL, AT OL

ˆ Vorgehen: x

k+1

= F (x

k

) = x

k

f(xk)

f(xk)

ˆ Abbruchkriterium: ∣x

k+1

− x

k

∣ ≤ ∣x

k+1

∣ ⋅ RT OL + AT OL

⊞ schnell

⊟ lokal, teuer, f

(x) muss bekannt sein

3.1.3 Banachscher Fixpunktsatz Folgende Bedingungen m¨ ussen erf¨ ullt sein:

ˆ F bidet das Intervall I = [a, b] in sich ab. Umkehrung m¨ oglich.

ˆ F ist eine Kontraktion: ∃ 0 < L < 1 L ≥ ∣

F(x

1)−F(x2) x1−x2

∣ Falls F

stetig ist auf I gen¨ ugt ∣F

∣ ≤ L < 1

▸ Falls F

′′

in ganz I das gleiche Vorzeichen hat, nur ∣F

(a)∣,∣F

(b)∣

betrachten, sonst auch Maxima @ F

′′

= 0 Daraus folgt dann:

ˆ F hat genau einen Fixpunkt x in [a, b]

ˆ Es gelten folgende Fehlerabsch¨ atzungen

ˆ ∣x − x

k

∣ ≤

L

k

1−L

∣x

1

− x

0

∣ a priori

ˆ ∣x − x

k

∣ ≤

1−LL

∣x

k

− x

k−1

∣ a posteriori

Die a priori Absch¨ atzung wird vor allem dazu benutzt nach nur einer Iteration bereits eine obere Schranke f¨ ur die Zahl der Iterationen ang- zugeben. Die ben¨ otigt wird um x bis auf einen Fehler ε zu bestimmen.

∣x − x

k

∣ ≤

L

k

1−L

∣x

1

− x

0

∣ ≤ ε ⇒ k ≥

ln∣xε(1−L) 1−x0∣ lnL

Es gibt anziehende- und abstossende Fixpunkte

∣F

(x)∣ < 1, so ist x anziehend

∣F

(x)∣ > 1, so ist x abstossend

∣F

(x)∣ = 1, so kann x anziehend, abstossend oder keines von beiden sein Je kleiner ∣F

(x)∣ ist, desto schneller konvergiert das Verfahren. Die selben Bedingungen gelten f¨ ur die inverse Iteration f¨ ur (F

−1

)

.

3.1.4 Konvergenzordnung p

∣x − x

n+1

∣ ≅ C∣x − x

n

p

CG-Verfahren: p = 1 Fixpunktiteration: p = 1 Newton-Verfahren: p = 2 Sekantenmethode: p = 1.6 Bisektionsverfahren: p = 1

3.1.5 Effizienzindex E

E = p

1/m

wobei m die Zahl der Funktionsauswertungen in jedem Schritt bedeutet.

3.1.6 Die Sekantenmethode

Sekantenmethode . . . .

ˆ Start: x

0

, x

1

, RT OL, AT OL

ˆ Vorgehen: x

k+1

=

xk−1f(xf(xk)−xkf(xk−1)

k)−f(xk−1)

ˆ Abbruchkriterium: ∣x

k+1

− x

k

∣ ≤ ∣x

k+1

∣ ⋅ RT OL + AT OL

⊞ braucht keine Ableitung, billiger als Newton

⊟ lokal, langsamer als Newton

(3)

3.1.7 Das Bisektionsverfahren

ˆ Gegeben: f(x), stetig im Intervall [a, b] und f (a) ⋅ f(b) < 0

Bisektionsverfahren (Divide and Conquer) . . . .

ˆ Start: a

0

, b

0

, x

0

=

a0+b0

2

, x

1

, RT OL, AT OL

ˆ Vorgehen:

i if f(x

k

) = 0 then break

ii if f(a

k

) ⋅ f(x

k

) < 0 then a

k+1

= a

k

, b

k+1

= x

k

else a

k+1

= x

k

, b

k+1

= b

k

x

k+1

=

ak+1+bk+1

2

ˆ Abbruchkriterium: ∣x

k+1

− x

k

∣ ≤ ∣x

k+1

∣ ⋅ RT OL + AT OL

⊞ global

⊟ langsame Konvergenz

3.2 Mehrere Gleichungen mit mehreren Unbekannten

Gegeben: f(x) = 0 mit x =

⎜ ⎜

⎝ x

1

. . x

n

⎟ ⎟

⎠ f (x) =

⎜ ⎜

f

1

(x1, . . . , x

n

) . . f

n

(x

1

, . . . , x

n

)

⎟ ⎟

=

⎜ ⎜

⎝ 0 . . 0

⎟ ⎟

⎠ Jacobi-Matrix: J(x) =

∂f∂x

=

⎜ ⎜

∂f1

∂x1

∂f1

∂x2

. . .

∂x∂f1

n

.. ..

∂fn

∂x1

∂fn

∂x2

. . .

∂x∂fn

n

⎟ ⎟

⇒ Linearisierung von f in x

0

3.2.1 Newton Verfahren (nD)

Das Newton-Verfahren ist immer lokal konvergent, falls det(J(x

)) ≠ 0 Es konvergiert quadratisch. Es gilt der Banachsche Fixpunktsatz, ersetze ∣.∣

durch ∣∣.∣∣

Newtonverfahren in R

n

. . . .

ˆ Start: x

0

, RT OL, AT OL

ˆ Vorgehen:

i J(x

k

)∆

k

= −f (x

k

) ⇒ ∆

k

= J(x

k

)/ − f (x

k

) ii x

k+1

∶= x

k

+ ∆

k

ˆ Abbruchkriterium: ∣∣∆

k

∣∣ ≤ ∣∣x

k+1

∣∣ ⋅ RT OL + AT OL

1

f u n c t i o n[ x , it ]= m y _ n e w t o n ( x0 , rtol , atol , m a x i t )

2

it =0; x = x0 ;

3

w h i l e ( it < m a x i t )

4

d e l t a = - J ( x ) \ f ( x ) ;

5

x _ o l d = x ;

6

x = x _ o l d + d e l t a ;

7

it = it +1;

8

if ( n o r m ( d e l t a ) <= n o r m ( x ) * r t o l + a t o l )

9

b r e a k; % c o n v e r g e d

10

end

11

end

12

if ( it == m a x i t )

13

e r r o r ([’ no c o n v e r g e n c e a f t e r ’ , i n t 2 s t r( it ) , ’ i t e r a t i o n s ’]) ;

14

end;

15

end

16

f u n c t i o n[ f_ ]= f ( x ) % f ( x ) =0

17

x1 = x (1) ; x2 = x (2) ;

18

f_ =[ x1 + x2 ^3 ; x1 ^2+ x2 ];

19

end

20

f u n c t i o n[ J_ ]= J ( x )

21

x1 = x (1) ; x2 = x (2) ;

22

J_ =[1 3* x2 ^2 ; 2* x1 1];

23

end

⊞ quadratische Konvergenz

⊟ Finden eines guten Startvektors x

0

.

⊟ Berechnen der Jacobi-Matrix in jedem Schritt.

3.2.2 Quasi-Newton Verfahren (nD)

In jedem Schritt wird die gleiche Jacobi-Matrix J(x

0

) verwendet.

1

f u n c t i o n[ x , it ]= m y _ q u a s i n e w t o n ( x0 , rtol , m a x i t )

2

it =0; x = x0 ;

3

J0 = J ( x0 ) ; % < - -

4

w h i l e ( it < m a x i t )

5

d e l t a = - J0 \ f ( x ) ; % < - -

6

[ . . . ] % s a m e as m y _ n e w t o n

⊞ J nur noch einmal berechnen.

⊟ nur noch lineare Konvergenz

3.2.3 ged¨ ampftes Newton Verfahren (nD) Wie Newton, aber mit D¨ ampfungsfaktor α

k

.

x

k+1

∶= x

k

+ α

k

k

α

k,start

≪ 1 α

k,ende=1

⊞ gr¨ osserer lokaler Konvergenzbereich durch weniger ¨ Uberschiessen.

⊟ Durch D¨ ampfung aber langsamer.

4 Ausgleichsrechnung

Gesucht wird ein Vektor x, so dass die dazugeh¨ origen Residuen r minimal sind.

4.1 Lineare Ausgleichsrechnung

4.1.1 mit Normalengleichungen nach Gauss i Fehlergleichungen: Ax − c = r

ii Normalengleichungen: A

T

A

²

A

x = A

T

c >> x=(A’A)\(A’c)

⊟ A

meist schlecht konditioniert ⇒ QR-Zerlegung

4.1.2 mit QR-Zerlegung

QR-Zerlegung von A aus Ax − c = r . . . . i QR-Zerlegung von A: A ↝ R c ↝ d

A

k+1

= U

pqT

⋅ A

k

c

k+1

= U

pqT

⋅ c

k

} bis A quadratisch, dann A = R und c = d U

pq

=

p → q →

cos φ 0 sinφ

0 1 0

− sinφ 0 cos φ

sinφ = −

A(q,p) A(p,p)2+A(q,p)2

cosφ =

A(p,p) A(p,p)2+A(q,p)2

ii R¨ uckw¨ artseinsetzen: Rx = d nach x

>> [Q,R]=qr(A) >> d=Q’c >> x=R0\d0 mit R0 quadratisch.

⊞ κ

Gauss

= κ(A

T

A) =

µµmax

min

κ

QR

= κ(A) =

√ κ(A

T

A)

4.1.3 mit Singul¨ arwertzerlegung A = U SV

T

ˆ Gegeben: Fehlergleichungen Ax − c = r

1

f u n c t i o n[ x , y ]= m y _ s v d ( A , c )

2

[ u , s , v ]= svd( A ) ;

3

k = r a n k ( A ) ;

4

[ rows , c o l s ]= s i z e ( A ) ;

5

y =[0 0] ’; % y to be a c o l u m n v e c t o r

6

for i =1: k

7

y ( i ) =1/ s ( i , i ) * u (: , i ) ’* c ;

8

end

9

for i = k +1: c o l s

10

y ( i ) =0; % a r b i t r a r y , c h o s e n to be 0

11

end

12

x = v * y ;

4.2 Nichtlineare Ausgleichsrechnung

Wie bei der linearen Ausgleichsrechnung ist die Kondition von A

T

A zu gross, weshalb man besser mit den Fehlergleichungen rechnet.

4.2.1 Gauss-Newton-Methode

ˆ Fehlergleichungen: f(x) − c = r

ˆ Linearisierte Fehlergln.: A

0

°

J@x0

ξ + f

0

− c

´¹¹¹¹¹¸¹¹¹¹¹¶

d0

= ρ

0

⇒ ξ

1

= A

0

/(ρ

0

− d

0

)

ˆ x

1

= x

0

+ ξ

1

und wieder von vorne...

⊟ Je nach x

0

keine Konvergenz → Minimierung.

4.2.2 Gauss-Newton-Methode mit Minimierung

Gleiches Vorgehen bis ξ

k+1

, dann mit ̃ x = x

k

+ tξ

k+1

und t = 1,

12

,

14

, ...

testen, ob S(̃ x) < S(x

k

) erf¨ ullt ist und bei ∣S(̃ x) − S(x

k

)∣ < T OL den Vorschlag ̃ x akzeptieren: x

k+1

= ̃ x. (S(x) = r

T

r)

⊞ Konvergenz garantiert, dank S(̃ x) < S(x

k

)

⊟ Langsame Konvergenz am Anfang m¨ oglich, aber am Ende doch wieder

fast quadratisch.

(4)

5 Interpolation und Approximation

5.1 Das Interpolationspolynom

ˆ Gegeben: n + 1 St¨ utzstellen x

0

, x

1

, . . . , x

n

und die St¨ utzwerte f

0

= f (x

0

), f

1

= f (x

1

), . . . , f

n

= f (x

n

).

ˆ Gesucht: Polynom ≤ n-ten Grades P

n

(x) = a

0

x

n

+a

1

x

n−1

+ ⋅ ⋅ ⋅ +a

n−1

x+

a

n

mit P

n

(x

0

) = f

0

, P

n

(x

1

) = f

1

, . . . , P

n

(x

n

) = f

n

5.1.1 Darstellung nach Lagrange

P

n

(x) =

n

i=0

f

i

l

i

(x) l

i

(x) =

n

j=0,j≠i

x − x

j

x

i

− x

j

i = 0, 1, . . . , n / Gegeben: 4 St¨ utzstellen und ihre Werte ⇒ n = 3

P

n

(x) = ∑

ni=0

f

i

l

i

(x) (Falls f

i

= 0 ⇒ l

i

nicht berechnen) l

0

(x) =

(x(x−x1)(x−x2)(x−x3)

0−x1)(x0−x2)(x0−x3)

l

1

(x) =

(x(x−x0)(x−x2)(x−x3)

1−x0)(x1−x2)(x1−x3)

l

2

(x) =

(x(x−x0)(x−x1)(x−x3)

2−x0)(x2−x1)(x2−x3)

l

3

(x) =

(x(x−x0)(x−x1)(x−x2)

3−x0)(x3−x1)(x3−x2)

5.1.2 Baryzentrsiche Darstellung

P

n

(x) = ∑

ni=0

µ

i

f

i

ni=0

µ

i

λ

i

∶=

1

nj=0,j≠i

(x

i

− x

j

) µ

i

∶=

λ

i

x − x

i

mit St¨ utzkoeffizienten λ

i

(Nenner von l

i

(x)) und i = 0,1, . . . , n.

⊞ Bei verschiedenen Polynomen weniger aufwendig als Lagrange.

λ

i

→ O(n

2

) (1x); P

n

(x) → O(n); bei Lagrange immer O(n

2

).

5.1.3 Fehler des Interpolationspolynoms f(x) − P

n

(x) = f

(n+1)

(ξ)

(n + 1)!

n

i=0

(x − x

i

) = O(h

n+1

) f(x) − P

n

(x) ≤

f(n+1)(n+1)!(ξ)

ni=0

(x − x

i

) mit ξ = x wo Fehler maximal

5.2 Splineinterpolation

Die Funktion f(x) wird st¨ uckweise mit Polynomen 3.Grades Q

i

(t) inter- poliert. Q

i

(t) ∶= P

i

(x

i

+ h

i

t) mit t =

x−xi

hi

und h

i

= x

i+1

− x

i

.

ˆ Q

i

(t) = f

i

(1 − 3t

2

+ 2t

3

) + f

i+1

(3t

2

− 2t

3

) + h

i

f

i

(t − 2t

2

+ t

3

) +h

i

f

i+1

(−t

2

+ t

3

)

ˆ Q ˙

i

(t) = f

i

(6t+6t

2

) +f

i+1

(6t−6t

2

) +h

i

f

i

(1−4t+2t

2

) +h

i

f

i+1

(−2t+3t

2

)

ˆ Q ¨

i

(t) = f

i

(−6 + 12t) + f

i+1

(6 − 12t) + h

i

f

i

(−4 + 6t) + h

i

f

i+1

(−2 + 6t)

ˆ ...

Q

i

(t) = 12f

i

− 12f

i+1

+ 6h

i

f

i

+ 6h

i

f

i+1

ˆ Q

i

(0) = f

i

Q

i

(1) = f

i+1

Q ˙

i

(0) = h

i

f

i

Q ˙

i

(1) = h

i

f

i+1

.

Sind die Ableitungen bekannt, handelt es sich um die Hermite- Interpolation und im Algorithmus beginnt man bei Schritt 2.

ˆ Sind die Ableitungen nicht bekannt, fehlen diese Gleichungen, man stellt daher zus¨ atzliche Forderungen:

ˆ 1.Forderung: P

i′′

(x

i+1

) = P

i+1′′

(x

i+1

) ⇒

i(1) h2i

=

i+1(0) h2i+1

ˆ 2.Forderung “not a knot“:

P

1

(x) = P

2

(x)

P

n−2

(x) = P

n−1

(x) } ⇒

⎧ ⎪

⎪ ⎪

⎪ ⎪

⎪ ⎪

Q

...

1(1) h31

=

Q

...

2(0) h32 Q

...

n−2(1)

h3n−2

=

Q

...

n−1(0) h3n−1

ˆ 2.Forderung “nat¨ urliche Randbedingung“:

P

1′′

(x

1

) = P

n−1′′

(x

n

) = 0 ⇒

Q¨1(0) h21

=

n−1(1) h2n−1

= 0

ˆ 2.Forderung “periodische Funktion“:

P

1′′

(x

1

) = P

n−1′′

(x

n

) ⇒

1(0) h21

=

n−1(1) h2n−1

periodische Funktion ⇒ { f

1

= f

n

f

1

= f

n

Spline-Interpolationsfunktion g(x). . . . i Finde L¨ osung aus Af

= d

↘ not a knot:

⎜ ⎜

⎜ ⎜

⎜ ⎜

⎝ b

1 a1

2

b

1

a

1

b

2

b

2

a

2

b

3

... ... ...

b

n−2

a

n−2

b

n−1 an−2

2

b

n−1

⎟ ⎟

⎟ ⎟

⎟ ⎟

⎜ ⎜

⎜ ⎜

⎜ ⎜

⎝ f

1

f

2

f

3

...

f

n−1

f

n

⎟ ⎟

⎟ ⎟

⎟ ⎟

=

⎜ ⎜

⎜ ⎜

⎜ ⎜

⎝ d

1

d

2

d

3

...

d

n−1

d

n

⎟ ⎟

⎟ ⎟

⎟ ⎟

↘ nat¨ urliche RB:

⎜ ⎜

⎜ ⎜

4 2

b

1

a

1

b

2

... ... ...

b

n−2

a

n−2

b

n−1

2 4

⎟ ⎟

⎟ ⎟

⎜ ⎜

⎜ ⎜

⎝ f

1

f

2

...

f

n−1

f

n

⎟ ⎟

⎟ ⎟

=

⎜ ⎜

⎜ ⎜

⎜ ⎜

6(f1−f2) h1

d

2

...

d

n−1

6(fn−fn−1) hn−1

⎟ ⎟

⎟ ⎟

⎟ ⎟

↘ periodische RB, h = const.:

⎜ ⎜

⎜ ⎜

8 2 2

b a b

... ... ...

b a b

b b a

⎟ ⎟

⎟ ⎟

⎜ ⎜

⎜ ⎜

⎝ f

1

f

2

...

f

n−2

f

n−1

⎟ ⎟

⎟ ⎟

=

⎜ ⎜

⎜ ⎜

6

h

(f

2

− f

n−1

) d

2

...

d

n−2

d

n−1

⎟ ⎟

⎟ ⎟

⎠ h

i

∶= x

i+1

− x

i

, i = 1, . . . , n − 1

b

i

∶=

1

hi

, i = 1, . . . , n − 1 a

i

∶= 2(b

i

+ b

i+1

), i = 1, . . . , n − 2 c

i

∶=

fi+1−fi

h2i

, i = 1, . . . , n − 1 d

1

∶= 2c

1

+

hh1

1+h2

(c

1

+ c

2

) (nur bei “not a knot“) d

i

∶= 3(c

i−1

+ c

i

), i = 2, . . . , n − 1

d

n

∶= 2c

n−1

+

hn−1

hn−1+hn−2

(c

n−1

+ c

n−2

) (nur bei “not a knot“) ii Bestimme den Index i, f¨ ur den gilt x

i

≤ x ≤ x

i+1

iii Setze t =

x−xi

hi

iv Berechne Qi(t) = α

0

+ [β

0

+ (γ

0

+ δ

0

t)(t − 1)]t , wobei β

−1

= h

i

f

i

α

0

= f

i

γ

0

= β

0

− β

−1

β

0

= α

1

− α

0

δ

0

= γ

1

− γ

0

α

1

= f

i+1

γ

1

= β

1

− β

0

β

1

= h

i

f

i+1

v Setze g(x) = Q

i

(t).

Allgemeines Vorgehen beim L¨ osen eines Problems:

1 Entscheiden, welche 2.Forderung gew¨ ahlt wird ⇒ Gleichunssystem hin- schreiben.

2 Tabelle erstellen, um den Vektor der rechten Seite d

i

zu finden. Glei- chungssystem mit TR::rref() l¨ osen.

3 Aus f

i

per Hermiteschen Algorithmus (ii bis v) die gesuchte Funktion g(x) finden, wobei g(x) = Qi(t) = α

0

+ [β

0

+ (γ

0

+ δ

0

t)(t − 1)]t mit TR::qi(α

0

, β

0

, γ

0

, δ

0

, t).

1

f u n c t i o n[ yy ]= m y _ s p l i n e _ n o t a k n o t ( x , fx , xx )

2

h = d i f f ( x ) ;

3

b = 1 . / h ;

4

a = 2 * ( b (1: end -1) + b (2: end ) ) ;

5

c = d i f f ( fx ) ./ h . ^ 2 ;

6

d = [ 2 * c (1) + h (1) /( h (1) + h (2) ) *( c (1) + c (2) ) ,...

7

3*( c (1: end -1) + c (2: end) ) ,...

8

2* c ( end) + h ( end ) /( h (end -1) + h ( end) ) * . . .

9

( c (end) + c ( end -1) ) ];

10

A = s p d i a g s ([[ b (1: end -1) ’; a ( end) / 2 ; 1 ] . . .

11

[ b (1) ; a ’; b (end ) ] . . .

12

[1; a (1) /2; b (1: end -1) ’]] ,...

13

-1:1 , l e n g t h( x ) , l e n g t h( x ) ) ;

14

f _ p r i m e = A \ d ’;

15

for k =1: l e n g t h( xx )

16

i = min( f i n d (( xx ( k ) - x ) <0) ) -1;

17

t =( xx ( k ) - x ( i ) ) / h ( i ) ;

18

a l p h a =[ fx ( i ) fx ( i +1) ];

19

b e t a =[ h ( i ) * f _ p r i m e ( i ) d i f f ( a l p h a ) ...

20

h ( i ) * f _ p r i m e ( i +1) ];

21

g a m m a = d i f f ( b e t a ) ;

22

d e l t a = d i f f ( g a m m a ) ;

23

yy ( k ) = a l p h a (1) +( b e t a (2) + . . .

24

( g a m m a (1) + d e l t a (1) * t ) *( t -1) ) * t ;

25

end

>> [yy]= spline(x,fx,xx) ≡ my spline notaknot.m 5.2.1 Interpolationsfehler

Der Interpolationsfehler ist von der Ordnung O(h

4

). Verglichen mit dem Interpolationspolynom O(h

n+1

) ist das viel besser, je gr¨ osser n ist. Beim Interpolationspolynom f¨ ur n gross hat es zwischen den St¨ utzstellen Extre- malwerte, die gegen den Rand und mit zunehmendem n immer gr¨ osser werden. Dieses Verhalten zeigt die Splineinterpolation nicht.

5.3 Trigonometrische Interpolation

Diskrete Fourier-Transformation (DFT) und Fast Fourier Transformation (FFT) spielen eine wichtige Rolle in der Signal- und Bildverarbeitung, im besonderen auch bei der Daten-Kompression.

ˆ Problemstellung: Es sind N St¨ utzstellen x

k

sowie deren St¨ utzwerte f

k

einer 2π-periodischen Funktion gegeben.

ˆ Gesucht: ein trigonometrisches Polynom

p(x) =

a20

+ ∑

N/2−1j=1

[a

j

cos(jx) + b

j

sin(jx)] +

aN/22

cos (

N

2

x)

(5)

5.3.1 DFT

Fourier-Reihe von f : f (x) = ∑

j=−∞

c

j

e

ijx

c

j

=

1

0

f (x)e

−ijx

dx Dieses Integral kann nat¨ urlich nicht gel¨ ost werden, da die Funtkion f(x) nur an N Stellen bekannt ist ⇒ Approximation des Integrals durch Tra- pezn¨ aherung c ˜

j

=

N1

N−1l=0

f (x

l

)e

−ijxl

, mit x

l

=

l2πN

.

Analyse: ˜ c

(N)

=

1

N

W f

(N)

Synthese: f

(N)

= W ˜ c

(N)

mit f

(N)

=

⎝ f

0

⋮ f

N−1

˜ c

(N)

=

˜ c

0

˜ c

N−1

und W =

⎜ ⎜

⎜ ⎜

⎜ ⎜

1 1 1 ⋯ 1

1 w w

2

⋯ w

N−1

1 w

2

w

4

⋯ w

2(N−1)

⋮ ⋮ ⋮ ⋱ ⋮

1 w

N−1

w

2(N−1)

⋯ w

(N−1)2

⎟ ⎟

⎟ ⎟

⎟ ⎟

, wobei w = e

−iN

und W das konjugiert komplexe von W . trigonometrische Interpolationspolynome

komplex: p(x) ∶= ∑

N/2+1j=−N/2+1

˜ c

j

e

ijx

+ ˜ c

N/2

cos(

N2

x)

2π-periodisch:

⎧ ⎪

⎪ ⎪

⎪ ⎪

⎪ ⎩

p(x)

3

∶= ˜ c

0

+ c ˜

1

e

ix

+ ˜ c

2

e

−ix

p(x)

5

∶= ˜ c

0

+ c ˜

1

e

ix

+ ˜ c

2

e

−ix

+ ˜ c

3

e

2ix

+ ˜ c

4

e

−2ix

. . .

reell: p(x) ∶=

a20

+ ∑

N/2+1j=1

[a

j

cos(jx) + b

j

sin(jx)] +

aN/22

cos(

N2

x) Allgemeines Vorgehen:

1 Diskrete Fourier-Analyse ˜ c

(N)

=

N1

W f

(N)

. 2 Auswertung des Polynoms p(x).

/ Bestimme das interpolierende trigonometrische Polynom von der 2π- periodischen Funktion mit x

i

0

3 3

f

i

f

0

f

1

f

2

˜ c

(3)

=

1

3

W f

(3)

=

1

3

1 1 1

1 w w

2

1 w

2

w

4

⎝ f

0

f

1

f

2

=

⎜ ⎜

f0+f1+f2 3 f0+wf1+w2f2

3 f0+w2f1+w4f2

3

⎟ ⎟

⎠ mit

⎧ ⎪

⎪ ⎪

⎪ ⎪

⎪ ⎪

⎪ ⎪

⎪ ⎩

w = e

−iN

= e

−i3

= −

1

2

√3 2

i w

2

= e

−2iN

= e

−i3

= −

1

2

+

√3 2

i w

4

= w = e

−i3

= −

12

√3 2

i

˜ c

(3)

=

⎜ ⎜

⎜ ⎜

f0+f1+f2 3

f0+f1(−1223i)+f2(−12+23i) 3

f0+f1(−12+23i)+f2(−1223i) 3

⎟ ⎟

⎟ ⎟

p(x) = ˜ c

0

+ ˜ c

1

e

ix

+ ˜ c

2

e

−ix

= ˜ c

0

+ (˜ c

1

+ c ˜

2

) cos(x) + i(˜ c

1

− ˜ c

2

)sin(x) mit

⎧ ⎪

⎪ ⎪

⎪ ⎪

⎪ ⎪

⎪ ⎪

⎪ ⎩

˜

c

1

+ ˜ c

2

=

2f0−f1−f2

3

˜

c

1

− ˜ c

2

=

−i

√3f1+i√ 3f2 3

i(˜ c

1

− ˜ c

2

) =

√3f1−√ 3f2 3

p(x) =

f0+f31+f2

+

2f0−f1−f2

3

cos(x) +

√3f1−√ 3f2 3

sin(x)

5.3.2 FFT

Sei γ

(N)

= W f

(N)

= N˜ c

(N)

und N = 2n , womit w

N

= 1 und w

n

= −1.

gerade approximative Fourier-Koeffizienten: γ

2k

= ∑

n−1j=0

(w

2

)

kj

(f

j

+ f

j+n

) ungerade approx. Fourier-Koeffizienten: γ

2k+1

= ∑

n−1j=0

(w

2

)

kj

(f

j

−f

j+n

)w

j

Die Anzahl komplexer Multiplikationen betr¨ agt µ =

N

2

log

2

(

N

2

).

Wir betrachten den Fall N = 2

m

, hier konkret: m = 3, N = 8, n = 4.

Es gilt: w = e

−iN

, w

8

= 1, w

4

= −1

W

(N)

=

⎜ ⎜

⎜ ⎜

⎜ ⎜

⎜ ⎜

⎜ ⎜

⎝ γ

0

γ

2

γ

4

γ

6

γ

1

γ

3

γ

5

γ

7

⎟ ⎟

⎟ ⎟

⎟ ⎟

⎟ ⎟

⎟ ⎟

=

⎜ ⎜

⎜ ⎜

⎜ ⎜

⎜ ⎜

⎜ ⎜

1 1 1 1 1 1 1 1

1 w

2

w

4

w

6

1 w

2

w

4

w

6

1 w

4

1 w

4

1 w

4

1 w

4

1 w

6

w

4

w

2

1 w

6

w

4

w

2

1 w w

2

w

3

w

4

w

5

w

6

w

7

1 w

3

w

6

w w

4

w

7

w

2

w

5

1 w

5

w

2

w

7

w

4

w w

6

w

3

1 w

7

w

6

w

5

w

4

w

3

w

2

w

⎟ ⎟

⎟ ⎟

⎟ ⎟

⎟ ⎟

⎟ ⎟

⎠ Das ganze faktorisiert ergibt: W ̂

(N)

= ( W

(n)

0

0 W

(n)

) D

(N)

W ̂

(N)

=

⎜ ⎜

⎜ ⎜

⎜ ⎜

⎜ ⎜

⎜ ⎜

1 1 1 1

1 w

2

w

4

w

6

1 w

4

1 w

4

1 w

6

w

4

w

2

1 1 1 1

1 w

2

w

4

w

6

1 w

4

1 w

4

1 w

6

w

4

w

2

⎟ ⎟

⎟ ⎟

⎟ ⎟

⎟ ⎟

⎟ ⎟

⎜ ⎜

⎜ ⎜

⎜ ⎜

⎜ ⎜

⎜ ⎜

⎜ ⎜

1 1

1 1

1 1

1 1

1 w

4

w w

5

w

2

w

6

w

3

w

7

⎟ ⎟

⎟ ⎟

⎟ ⎟

⎟ ⎟

⎟ ⎟

⎟ ⎟

⎠ mit

⎧ ⎪

⎪ ⎪

⎪ ⎪

⎪ ⎪

⎪ ⎪

⎪ ⎩ w

4

= −1 w

5

= −w w

6

= −w

2

w

7

= −w

3

Die Matrixmultiplikation z = D

(N)

f

(N)

l¨ asst sich einfach durchf¨ uhren. Die ubriggebliebene Rechnung ¨ ̂ γ

(N)

= ( W

(n)

0

0 W

(n)

) z

(N)

l¨ asst sich wie- derum auf zwei diskrete Fourier-Transformationen der Ordnung n = 4, im n¨ achsten Schritt weitere R¨ uckf¨ uhrung auf n = 2 und dann n = 1

1

f u n c t i o n []= m y _ f f t

2

N = 2 0 ; m =5; M = N *2^ m ;

3

% N b i g - - > m o r e i n i t i a l d a t a

4

% m , M b i g - - > m o r e i n t e r p o l a t i o n p o i n t s

5

x_k =2*pi/ N * [ 0 : N -1] ’; % i n i t i a l : n p o i n t s

6

f_k =sin (4* x_k ) . ^ 2 ; % g i v e n ( e x a m p l e )

7

c = fft( f_k / N ) ; % a n a l y s i s

8

c _ s t a r =[ c (1: N /2) ;z e r o s ( M - N ,1) ; c ( N / 2 + 1 : end ) ];

9

x _ s t a r =2*pi/ M * [ 0 : M -1] ’; % n e w : m > n p o i n t s

10

f _ s t a r = M *i f f t ( c _ s t a r ) ; % s y n t h e s i s

⊞ Aufwand fft: O(N log

2

N) Aufwand dft: O(N

2

)

6 Numerische Integration und Differentiation

6.1 Numerische Integration - Quadratur

Bei der numerischen Integration soll das Integral I = ∫

ab

f (x)dx mit ̃ I ap- proximiert werden. Es werden nun einige dieser Verfahren vorgestellt.

6.1.1 Trapezmethode

ˆ Idee: Unterteilung der Funktion in n Intervalle der L¨ ange h =

b−a

n

und approximiere linear mit T (h) =

h2

[f

a

+ f

b

]

I ̃ = T (h) = h

2 [f

0

+ f

1

] + h

2 [f

1

+ f

2

] + ⋯ + h

2 [f

n−1

+ f

n

]

= h [ 1

2 f

0

+ f

1

+ ⋯ + f

n−1

+ 1 2 f

n

]

ˆ Das Trapezverfahren approximiert mind. Polynome des 1. Grades exakt.

ˆ Absch¨ atzung: ∣I − T (h)∣ ≤

M12

(b − a)h

2

, M ≥ ∣f

′′

(x)∣, x ∈ [a, b]

ˆ Das Trapezverfahren hat Ordnung 2.

Trapezverfahren mit Schritthalbierung . . . .

ˆ Start: a, b, RT OL, AT OL

ˆ 1.Schritt:

i h

0

= b − a ii s

0

=

1

2

(f(a) + f(b)) iii T

0

= s

0

h

0

iv N

0

= 1

ˆ weitere Schritte: (n = 0, 1,2, . . .) i h

n+1

=

hn

2

ii s

n+1

= s

n

+ ∑

Nj=1n

f(a + (2j − 1)h

n+1

) iii T

n+1

= h

n+1

s

n+1

iv N

n+1

= 2N

n

ˆ Abbruchbedingung: ∣T

n+1

− T

n

∣ ≤ ∣T

n+1

∣ ⋅ RT OL + AT OL

6.1.2 Simpson’sche Formel

ˆ Idee: Unterteilung der Funktion in 2n Intervalle der L¨ ange h =

b−a

2n

und

approximiere quadratisch mit S(h) =

h3

[f

a

+ 4f

c

+ f

b

]

(6)

I ˜ = S(h) = h

3 [f

0

+ 4f

1

+ f

2

] + h

3 [f

2

+ 4f

3

+ f

4

] + ⋅ ⋅ ⋅ +

h

3 [f

2n−2

+ 4f

2n−1

+ f

2n

]

= h

3 [f

0

+ 4f

1

+ 2f

2

+ 4f

3

+ 2f

4

+ ⋅ ⋅ ⋅ + 2f

2n−2

+ 4f

2n−1

+ f

2n

]

ˆ Die Simpson-Methode approximiert mindestens Polynome des 3. Grades exakt.

ˆ Absch¨ atzung: ∣I − S(h)∣ ≤

180M

(b − a)h

4

, M ≥ ∣f

(4)

(x)∣, x ∈ [a, b]

ˆ Die Simpson-Methode hat Ordnung 4.

Simpson-Methode mit Trapezwerten . . . .

ˆ Start: a, b, RT OL, AT OL

ˆ Berechnung der Trapezwerte: T

0

, T

1

, T

2

, . . .

ˆ Berechnung der Simpsonwerte:

S

1

=

4T13−T0

, S

2

=

4T23−T1

, S

3

=

4T33−T2

, . . .

ˆ Abbruchbedingung: ∣S

n+1

− S

n

∣ ≤ ∣S

n+1

∣ ⋅ RT OL + AT OL

6.1.3 Romberg-Verfahren

ˆ Idee: Durch Kombination von verschiedenen Trapezwerten kann man Fehlerterme tiefer Ordnung eliminieren und so die Ordnung des Verfah- rens erh¨ ohen → Simpsonwerte. Mit diesen verf¨ ahrt man genauso...:

R

0,0

= T (h) = I + c

1

h

2

+c

2

h

4

+ . . . T (

h

2

) = I +

1

4

c

1

h

2

+

1

16

c

2

h

4

+. . . R

1,1

= S

1

= S (

h

2

) =

4T(

h 2)−T(h)

3

=

T(h2)−4−1T(h) 1−4−1

= I −

1

4

c

2

h

4

+ O(h

6

) R

2,2

=

16S(

h 4)−S(h2)

15

=

S(h4)−4−2S(h2)

1−4−2

= I + O(h

6

)

Romberg-Verfahren . . . .

Start:

h

0

= b − a, h

1

=

h0

2

, h

2

=

h1

2

, . . . RT OL, AT OL

Romberg-Verfahren:

R

j,0

= T

j

R

j,k

=

Rj,k−1−4

−kRj−1,k−1 1−4−k

Abbruchbedingung: ∣R

j,j

− R

j,j−1

∣ ≤ ∣R

j,j

∣ ⋅ RT OL + AT OL

6.1.4 Guass’sche Quadraturformeln

Die Gauss’sche Quadraturformel gilt f¨ ur das Integral I = ∫

−11

f(x)dx. Das allgemeine Integral I = ∫

ab

g(x)dx muss daher in diese Form transformiert werden.

Die n-Punkt Quadraturformel lautet:

I ˜ = Q

n

=

n

j=1

w

j

f

j

, wobei die Funtionswerte f

j

und die Gewichte w

j

f(x) = b − a 2 g (

b − a 2 x +

a + b 2 ) w

j

= ∫

1

−1

⎡ ⎢

⎢ ⎢

⎢ ⎣

n

k=1,k≠j

( x − x

k

x

j

− x

k

)

2

⎥ ⎥

⎥ ⎦

dx > 0 j = 1,2, . . . , n

⊞ Eine n-Punkt-Quadraturformel hat Genauigkeitsgrad von (2n-1), wenn die Nullstellen der Legende-Polynome verwendet werden.

⊞ Es werden viel weniger Funktionsaufrufe ben¨ otigt.

⊟ Aber daf¨ ur m¨ ussen viele Funktionswerte bekannt sein.

6.2 Numerische Differentiation

Notwendig ist numerische Differentiation, wenn nur einige Werte der Funk- tion bekannt sind. Mit der Talyorentwicklung um z:

f (z + h) = f(z) +

1!h

f

(z) +

h2!2

f

′′

(z) + ⋅ ⋅ ⋅ +

hk!k

f

(k)

(z) f (z − h) = f(z) −

1!h

f

(z) +

h2!2

f

′′

(z) − . . .

...lassen sich Approximationen f¨ ur f

(z) herleiten:

Vorw¨ arts-Differenzenquotient:

f(z+h)−fh (z)

= f

(z) +

h2

f

′′

+ O(h

2

) R¨ uckw¨ arts-Differenzenquotient:

f(z)−f(z−h)h

= f

(z) −

h2

f

′′

+ O(h

2

) Symmetrische Differenzquotienten der Ordnung 1 , 2 und n:

1h

(z) = f (z + h) − f(z − h)

2h = f

(z) + h

2

6 f

′′′

(z) + O(h

3

)

2h

(z) = f (z + h) − 2f (z) + f(z − h)

h

2

= f

′′

+ O(h

2

)

nh

(z) = 1 (2h)

n

n

j=0

(−1)

j

a

j

f (z + b

j

h) a

j

= ( n

j ) b

j

= n − 2j mit dem Binomialkoeffizienten a

j

TR::ncr(n,j).

F¨ ur grosse h ist das Ergebnis schlecht, doch auch zu kleine h resultieren in schlechten Ergebnissen aufgrund Ausl¨ oschung.

h

optimal

10

−d

⋅ 2

∣f∣f(z)∣′′(z)∣

, d-stellige Gleitpunktarithmetik

7 Gew¨ ohnliche Differentialgleichungen

Gegeben: Die DGL x ˙ = f (t, x), sowie der Anfangswert x(t

0

) = x

0

. Gesucht: Die Approximation an der Endstelle ̃ x(t

f

).

7.1 Explizite Einschrittverfahren 7.1.1 Das explizite Eulerverfahren

Wir approximieren x(t + h) durch das Taylorpolynom vom Grad 1:

x(t) + x(t)h. Per Definition ist ˙ x(t) = ˙ f (t, x(t)) und somit F (t, x, h) ∶= x + hf (t, x).

Das Eulerverfahren ist wie folgt definiert:

̃ x

j+1

= F (t

j

,̃ x

j

, h

j

) = ̃ x

j

+h

j

f (t

j

,̃ x

j

) x ˜

0

= x0 j = 0, 1, . . . , n − 1

Bei ¨ aquidistanten Schritten gilt: h ∶=

tf−t0

n

t

j

∶= t

0

+ jh.

1

f u n c t i o n[ x _ t f ]= m y _ e e u l e r _ m a i n

2

f1 = @ ( x , t ) x ^2+ t ^2; % f u n c t i o n h a n d l e

3

h = 0 . 1 ; % ^ - - on f = x p r i m e

4

x0 =0;

5

t0 =0; tf =1;

6

n =( tf - t0 ) / h ;

7

x _ t f = m y _ e e u l e r ( f1 , t0 , x0 , h , n ) ;

1

f u n c t i o n[ x ]= m y _ e e u l e r ( f , t0 , x0 , h , n )

2

x = x0 ;

3

t = t0 ;

4

for it =1: n

5

x = x + h * f ( x , t )

6

t = t + h ;

7

end

Lokaler Fehler bei j + 1: l(t

j

,̃ x

j

, h) ∶= F (t

j

,̃ x

j

, h)

´¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¸¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¹¶

̃ xj+1

−x(t

j

+ h)

wobei x(t

j

+ h) die L¨ osung an der Stelle t

j

+ h ist.

Globaler Fehler f¨ ur t = t

j

: ̃ x

j

− x(t

j

)

Die Fehlerordnung p (Ordnung des globalen Fehlers) eines Verfahrens mit Verfahrensfunktion F (t, x, h) ist gleich der Anzahl ¨ ubereinstimmender Ter- me in den Taylorentwicklungen nach h von x(t +h) und von F (t, x(t), h).

ˆ Der lokale Fehler des Verfahrens ist von der Ordnung O(h

p+1

), beim expliziten Euler O(h

2

).

ˆ Der globale Fehler des Verfahrens ist von der Ordnung O(h

p

), beim ex- pliziten Euler O(h). Ein k-fach kleinerer Schritt h ergibt einen k-fach kleineren globalen Fehler.

7.1.2 Taylorverfahren h¨ oherer Ordnung Ordnung 2: Wir approximieren x(t + h) durch:

x(t) + x(t)h ˙ + x(t) ¨

h22

(Taylorpolynom vom Grad 2)

¨

x(t) = f

t

(t, x(t)) + f

x

(t, x(t)) x(t) = ˙ f

t

(t, x(t)) + f

x

(t, x(t))f(t, x(t)) F (t, x, h) = x + hf (t, x) +

h22

[f

t

(t, x) + f

x

(t, x)f(t, x)]

Das Taylor-Verfahren der Ordnung 2 ist also wie folgt definiert:

̃ x

j+1

=F (t

j

, ̃ x

j

, h

j

)

=̃ x

j

+ h

j

f (t

j

,̃ x

j

) + h

2j

2 [f

t

(t

j

,̃ x

j

) + f

x

(t

j

, ̃ x

j

)f(t

j

,̃ x

j

)]

⊞ p = 2, lokaler Fehler somit O(h

3

) und globaler Fehler ist O(h

2

).

⊟ Die partiellen Ableitungen f

t

und f

x

m¨ ussen bekannt sein.

Grad p: Wir approximieren x(t + h) durch:

x(t) + x(t)h ˙ + ⋅ ⋅ ⋅ + x

(p)

(t)

hp!2

(das Taylorpolynom vom Grad p)

⊞ p = n, lokaler Fehler somit O(h

n+1

) und globaler Fehler ist O(h

n

).

⊟ Die partiellen Ableitungen von f bis zur Ordnung n−1 m¨ ussen bekannt

sein.

Referenzen

ÄHNLICHE DOKUMENTE

Für die abgeschlossenen Formeln treten für n &gt; 8 wechselnde Vorzeichen auf, für die offenen Formeln sogar schon für n &gt; 2.. Diese Formeln sind also anfällig

Wir betrachten nun das gestörte System (4.5) und nehmen an, dass die Störungen der Matrixelemente so klein sind, dass auch die Matrix A + ∆A regulär ist (dass dies für

Stabiler als das Gram-Schmidt-Verfahren sind Methoden zur Bestimmung der QR-Zerlegung einer Matrix, die auf der Multiplikation von A mit geeigneten orthogonalen Matrizen beruhen..

Naheliegend ist es nun, die Matrix A, deren Eigenwerte bestimmt werden sollen, durch geeignete Ähnlichkeitstransformationen auf eine Gestalt zu bringen, aus der man die Eigenwerte

Runge-Kutta Verfahren erm¨ oglichen eine einfache Schrittweitensteuerung, ha- ben aber den Nachteil gegen¨ uber den Adams Verfahren, dass in jedem Schritt die rechte Seite an

Die letzte Matrix ist nicht SPD, dieses ist sofort klar, wenn man sich erin- nert, dass jede Hauptunterabschnittsmatrix einer SPD-Matrix auch wieder SPD sein muss.. Das

F¨ ur den QR-Algorithmus in der Grundform ist wohlbekannt, dass die Anwendung auf eine beliebige (nicht- diagonale) orthogonale Matrix zu Stagnation des Algorithmus f¨ uhrt und

Die Konvergenz im Wesentlichen bedeutet, dass nur der untere Dreiecksanteil der solcherart erzeugten Matrizen A j gegen das Gew¨ unschte konvergiert: Die Elemente auf der