21.06.2014 Views

Numerical Methods Contents - SAM

Numerical Methods Contents - SAM

Numerical Methods Contents - SAM

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Code 2.4.8: Finding outeps in MATLAB<br />

1 >> format hex ; eps , format long ; eps<br />

2 ans = 3cb0000000000000<br />

3 ans = 2.220446049250313e−16<br />

2.5.1 Vector norms and matrix norms<br />

Remark 2.4.9 (Addingeps to 1).<br />

✸<br />

Norms provide tools for measuring errors. Recall from linear algebra and calculus:<br />

eps is the smallest positive<br />

number ∈ M for which 1˜+ǫ ≠<br />

1 (in M):<br />

Code 2.4.10: 1 + ǫ in MATLAB<br />

1 >> f p r i n t f ( ’ %30.25 f \ n ’ ,1+0.5∗eps )<br />

2 1.0000000000000000000000000<br />

3 >> f p r i n t f ( ’ %30.25 f \ n ’ ,1−0.5∗eps )<br />

4 0.9999999999999998889776975<br />

5 >> f p r i n t f ( ’ %30.25 f \ n ’ ,(1+2/ eps ) −2/eps ) ;<br />

6 0.0000000000000000000000000<br />

Definition 2.5.1 (Norm).<br />

X = vector space over field K, K = C, R. A map ‖ · ‖ : X ↦→ R + 0 is a norm on X, if it satisfies<br />

(i) ∀x ∈ X: x ≠ 0 ⇔ ‖x‖ > 0 (definite),<br />

(ii) ‖λx‖ = |λ|‖x‖ ∀x ∈ X,λ ∈ K (homogeneous),<br />

(iii) ‖x + y‖ ≤ ‖x‖ + ‖y‖ ∀x,y ∈ X (triangle inequality).<br />

In fact 1˜+eps = 1 would comply with the “axiom” of roundoff error analysis, Ass. 2.4.2:<br />

1 = (1 +eps)(1 + δ) ⇒ |δ| =<br />

eps<br />

∣1 +eps∣ ≤ eps ,<br />

2<br />

eps = (1 + 2<br />

∣ ∣∣∣<br />

)(1 + δ) ⇒<br />

eps |δ| = eps<br />

2 +eps∣ ≤ eps .<br />

Ôº½½¿ ¾º<br />

Examples: (for vector space K n , vector x = (x 1 , x 2 ,...,x n ) T ∈ K n )<br />

name : definition MATLAB function<br />

√<br />

Euclidean norm : ‖x‖ 2 := |x 1 | 2 + · · · + |x n<br />

Ôº½½ ¾º<br />

| 2 norm(x)<br />

1-norm : ‖x‖ 1 := |x 1 | + · · · + |x n | norm(x,1)<br />

∞-norm, max norm : ‖x‖ ∞ := max{|x 1 |,...,|x n |} norm(x,inf)<br />

Simple explicit norm equivalences:<br />

for all x ∈ K n<br />

!<br />

Do we have to worry about these tiny roundoff errors ?<br />

YES (→ Sect. 2.3):<br />

• accumulation of roundoff errors<br />

• amplification of roundoff errors<br />

✄ back to Gaussian elimination/LU-factorization with pivoting<br />

△<br />

Definition 2.5.2 (Matrix norm).<br />

‖x‖ 2 ≤ ‖x‖ 1 ≤ √ n ‖x‖ 2 , (2.5.1)<br />

‖x‖ ∞ ≤ ‖x‖ 2 ≤ √ n ‖x‖ ∞ , (2.5.2)<br />

‖x‖ ∞ ≤ ‖x‖ 1 ≤ n ‖x‖ ∞ . (2.5.3)<br />

Given a vector norm ‖·‖ on R n , the associated matrix norm is defined by<br />

M ∈ R m,n ‖Mx‖<br />

: ‖M‖ := sup<br />

x∈R n \{0} ‖x‖ .<br />

2.5 Stability of Gaussian Elimination<br />

Ôº½½ ¾º<br />

Issue: Gauge impact of roundoff errors on Gaussian elimination with partial pivoting !<br />

Ôº½½ ¾º<br />

✎ notation: ‖x‖ 2 → ‖M‖ 2 , ‖x‖ 1 → ‖M‖ 1 , ‖x‖ ∞ → ‖M‖ ∞<br />

sub-multiplicative: A ∈ K n,m ,B ∈ K m,k : ‖AB‖ ≤ ‖A‖ ‖B‖

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!