Академический Документы
Профессиональный Документы
Культура Документы
LU FACTORIZATION
Lecture No 9
Ax b
PROBLEM:
b modified in the process
for a different b
process needs to be repeated
LU Factorization 2 Dr. Jorge A. Olortegui Yume, Ph.D.
LU FACTORIZATION
To avoid the PROBLEM let´s do some matrix manipulation
Ax b Ax b 0
can modify
this eqn. to
give: u11 u12 u13 x1 d1
U :
U x d 0 u
where:
0
22 u x d
23 2 2
0 u33 x3 d 3 Upper triangular
Assume an lower
triangular matrix
exists such that
LU x d Ax b
where:
1 0 0
L : L l21 1 0
Lower triangular l31 l32 1
LU Factorization 3 Dr. Jorge A. Olortegui Yume, Ph.D.
LU FACTORIZATION
Then: LU x d Ax b
LU A
LU x Ld Ax b Ld b
In explicit form
1 0 0 u11 u12 u13 x1 1 0 0 d1 a11 a12 a13 x1 b1
l 1 0 0 u u x l 1 0 d a a23 x2 b2
21 22 23
2 21 2 21 a22
l31 l32 1 0 0 u33 x3 l31 l32 1 d 3 a31 a32 a33 x3 b3
1 0 0 u11 u12 u13 a11 a12 a13
l 1 0 0 u u a a23
21 22 23 21 a22
l31 l32 1 0 0 u33 a31 a32 a33
1 0 0 d1 b1
l 0 d 2 b2
21 1
l31 l32 1 d 3 b3
LU A
– Substitution to solve for {x}
– Forward (“Find d”)
Ld b
– Backward (“Find x”)
U x d
• Gauss elimination can be implemented using LU factorization
LU Factorization 6 Dr. Jorge A. Olortegui Yume, Ph.D.
LU FACTORIZATION
Using MATLAB
• To solve [A]{x}={b}, first decompose [A] to get
[L][U]{x}={b}
• Set up and solve [L]{d}={b}, where {d} can be found
using forward substitution.
• Set up and solve [U]{x}={d}, where {x} can be found
using backward substitution.
• In MATLAB:
[L, U] = lu(A)
d = L\b
x = U\d
U = chol(A)
• Includes trying:
• banded solvers
• back and forward substitutions
• Cholesky factorization for symmetric systems.
• If these do not work and the system is square, Gauss
elimination with partial pivoting is used.
1.- By hand
2.- Numerically
(Note: Solve with LU
factorization using Gauss Partial
pivoting and verify with “lu”
and “/”)
m= 1 kg
k= 100 N/m
LU Factorization 19 Dr. Jorge A. Olortegui Yume, Ph.D.
LU FACTORIZATION
Example: Determine the current in each branch of the circuit shown
1 12 0.1 25
2 10 0.5 40
3 - - 16
4 12 0.5 20
5 24 0.2 9
6 - - 4
7 - - 20