Post on 19-Dec-2015
LU method
1) factor (decompose) A into L and U
2) given b, determine d
3) using Ux=d and backsubstitution, solve for x
Advantage: Once you have L and U, can use many different b’s
Assume weight of 100 is localized at node 2
0
0
0
0
0
0
0
100
0
0
coscos
sinsin
coscos
sinsin
cos
sin
coscos
sinsin
cos
sin
453525
3525
452414
2414
3523
352
25242312
2524
1412
141
FFF
FF
FFF
FF
FF
FF
FFFF
FF
FFF
FF
V
H
V
0
0
0
0
0
0
0
100
0
0
1coscos
sinsin
1coscos
sinsin
cos1
sin1
coscos11
sinsin
cos11
sin1
45
35
25
24
23
14
12
2
1
F
F
F
F
F
F
F
F
F
F
V
H
V
How do we get inverse?
One way is through LU decomposition and backsubstitution
Solve Ax=b with , sequentually
1
0
0
,
0
1
0
,
0
0
1
bbb
Put together x’s to get inverse
To get inverse, solve using different b’s
0
0
1
12.475.0
0125.
001
0
3
2
1
d
d
d
bLd
8.102.475.0
25.0025.0
1
3321
221
1
dddd
ddd
d
8.1
25.0
1
1200
5.225.10
234
3
2
1
x
x
x
dUx
25.01234
1.025.05.225.1
15.08.112
1321
232
33
xxxx
xxx
xx
15.0
1.0
25.0
x
So the inverse is
0833.035.015.0
1667.01.01.0
0833.025.025.0321
1 xxxA
Check
1
1
1
0833.035.015.0
1667.01.01.0
0833.025.025.0
333
321
234
Matrix inverse is useful for determining condition number (ill conditioned) of matrix
1) Normalize rows of matrix to 1. If elements of A-1 are >> 1, probably ill conditioned
2) if A-1A is not close to I, probably ill conditioned
3) if (A-1)-1 is not A, probably ill conditioned
A little more technical
Norms - a way to measure “size” or “length” of a quantity
for matrices, use matrix norm
i j
ijaA 2
Matrix inverse is time consuming to calculate
A number of methods to avoid it
I.e Gauss elimination instead of
bAinvx *)(
Special matrices
Banded matrices
Tridiagonal matrices
nn
nnn
nnn
ba
cba
cba
cba
cba
cb
T
111
222
333
222
11
Tridiagonal matrices important for time evolution of systems
E.g traffic flow
30 nodes (stoplights)
Traffic at node xi at next time (xi,t+1) depends on
1) # of cars at xi at time t (xi,t) 2) # of cars at xi-1 at time t (xi-1,t) 3) # of cars at xi+1 at time t (xi+1,t)
1,30
1.2
1,1
,30
.2
,1
3030
292929
282828
333
222
11
*
t
t
t
t
t
t
x
x
x
x
x
x
ba
cba
cba
cba
cba
cb
Put all 30 equations together
Solve to get # of cars, and repeat to see how traffic responds to boundary conditions
Thomas algorithm to solve tridiagonal matrices
rTx
nnnn
nnn
nnn
r
r
r
x
x
x
ba
cba
cba
cba
cba
cb
2
1
2
1
111
222
333
222
11
*
Basically sets up an LU decomposition
three parts
1) decomposition
2) forward substitution
3) backward substitution
1) decompositionloop from rows 2 to n
ai = ai/bi-1
bi = bi-ai*ci-1
end loop
2) forward substitutionloop from 2 to n
ri = ri - ai*ri-1
end loop
loop from rows 2 to 5ai = ai/bi-1
bi = bi-ai*ci-1
end loop
21
543
311
1214
25
0515.11*0515.01
0515.0)4.19/(1
5/2 192*)5/4(21
5/4
3
3
2
2
b
a
b
a
0968.32194.0
55588.48529.2
30515.10515.0
14.198.0
25
forward substitutionloop from 2 to n
ri = ri - ai*ri-1
end loop
16
55
13
49
9
r
0968.32194.0
55588.48529.2
30515.10515.0
14.198.0
25
T
1546.158.41*0515.013
8.419*8.049
3
2
r
r
5806.18
7647.11
1546.15
8.41
9
r