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.

Scale linear system of equations from Ex. 2.3.1:<br />

( )( )( )<br />

2 /ǫ 0 ǫ 1 x1<br />

=<br />

0 1 1 1 x 2<br />

( )( )<br />

2 2/ǫ x1<br />

=<br />

1 1 x 2<br />

( ) 2 /ǫ<br />

1<br />

No row swapping, if absolutely largest pivot element is used:<br />

( ) ( ) ( ) ( )( )<br />

2 2/ǫ 1 0 2 2/ǫ · 1 0 2 2/ǫ<br />

=<br />

=<br />

1 1 1 1 0 1 − 2/ǫ 1 1 0 −2/ǫ<br />

in M .<br />

✬<br />

Lemma 2.3.2 (Existence of LU-factorization with pivoting).<br />

For any regular A ∈ K n,n there is a permutation matrix P ∈ K n,n , a normalized lower triangular<br />

matrix L ∈ K n,n , and a regular upper triangular matrix U ∈ K n,n (→ Def. 2.2.1), such that<br />

PA = LU .<br />

✫<br />

Proof. (by induction)<br />

✩<br />

✪<br />

Every regular matrix A ∈ K n,n admits a row permutation encoded by the permutation matrix P ∈<br />

K n,n , such that A ′ := (A) 1:n−1,1:n−1 is regular (why ?).<br />

1 % Example: importance of scale-invariant pivoting<br />

2 e p s i l o n = 5.0E−17;<br />

3 A = [ e p s i l o n , 1 ; 1 , 1 ] ; b = [ 1 ; 2 ] ;<br />

4 D = [ 1 / epsilon , 0 ; 0 , 1 ] ;<br />

5 A = D∗A ; b = D∗b ;<br />

6 x1 = A \ b ,<br />

7 x2 =gausselim (A, b ) , % see Code 2.1.5<br />

8 [ L ,U] = l u f a k (A) ; % see Code 2.2.1<br />

9 z = L \ b ; x3 = U\ z ,<br />

Theoretical foundation of algorithm 2.3.5:<br />

Ouput of MATLAB run:<br />

x1 = 1<br />

1<br />

x2 = 0<br />

1<br />

x3 = 0<br />

1<br />

Ôº½¼½ ¾º¿<br />

By induction assumption there is a permutation matrix P ′ ∈ K n−1,n−1 such that P ′ A ′ possesses a<br />

LU-factorization A ′ = L ′ U ′ . There are x,y ∈ K n−1 , γ ∈ K such that<br />

( ) ( ) (<br />

P ′ 0 P ′ 0 A ′<br />

) (<br />

x L ′ U ′ ) (<br />

x L ′<br />

)( )<br />

0 U d<br />

PA =<br />

0 1 0 1 y T =<br />

γ y T =<br />

γ c T ,<br />

1 0 α<br />

if we choose<br />

which is always possible.<br />

d = (L ′ ) −1 x , c = (u ′ ) −T y , α = γ − c T d ,<br />

✷<br />

Ôº½¼¿ ¾º¿<br />

Definition 2.3.1 (Permutation matrix).<br />

An n-permutation, n ∈ N, is a bijective mapping π : {1, ...,n} ↦→ {1, ...,n}. The corresponding<br />

permutation matrix P π ∈ K n,n is defined by<br />

{<br />

1 , if j = π(i) ,<br />

(P π ) ij =<br />

0 else.<br />

⎛ ⎞<br />

1 0 0 0<br />

permutation (1, 2, 3, 4) ↦→ (1, 3, 2, 4) ˆ= P = ⎜0 0 1 0<br />

⎟<br />

⎝0 1 0 0⎠ .<br />

0 0 0 1<br />

Example 2.3.6 (Ex. 2.3.2 cnt’d).<br />

⎛<br />

A = ⎝ 1 2 2<br />

⎞ ⎛<br />

2 −7 2 ⎠ →<br />

➊ ⎝ 2 −7 2<br />

⎞ ⎛<br />

1 2 2 ⎠ →<br />

➋ ⎝ 2 −7 2<br />

⎞ ⎛<br />

0 5.5 1 ⎠ →<br />

➌ ⎝ 2 −7 2<br />

⎞ ⎛<br />

0 27.5 −1 ⎠ →<br />

➍ ⎝ 2 −7 2<br />

⎞<br />

0 27.5 −1 ⎠<br />

1 24 0 1 24 0 0 27.5 −1 0 5.5 1 0 0 1.2<br />

⎛<br />

U = ⎝ 2 −7 2<br />

⎞ ⎛<br />

0 27.5 −1 ⎠, L = ⎝ 1 0 0<br />

⎞ ⎛<br />

0.5 1 0 ⎠ , P = ⎝ 0 1 0<br />

⎞<br />

0 0 1 ⎠ .<br />

0 0 1.2<br />

0.5 0.2 1 1 0 0<br />

MATLAB function: [L,U,P] = lu(A) (P = permutation matrix)<br />

✸<br />

Remark 2.3.7 (Row swapping commutes with forward elimination).<br />

Note:<br />

P H = P −1 for any permutation matrix P (→ permutation matrices are orthogonal/unitary)<br />

P π A effects π-permutation of rows of A ∈ K n,m<br />

AP π effects π-permutation of columns of A ∈ K m,n<br />

Ôº½¼¾ ¾º¿<br />

Any kind of pivoting only involves comparisons and row/column permutations, but no arithmetic operations<br />

on the matrix entries. This makes the following observation plausible:<br />

The LU-factorization of A ∈ K n,n with partial pivoting by Alg. 2.3.5 is numerically equivalent<br />

to the LU-factorization of PA without pivoting (→ Code 2.2.1), when P is a permutation matrix<br />

gathering the row swaps entailed by partial pivoting.<br />

Ôº½¼ ¾º¿

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

Saved successfully!

Ooh no, something went wrong!