Download presentation
Presentation is loading. Please wait.
1
The Gauss Jordan method
Major difference - eliminate unknowns from all rows, not just subsequent ones Normalize matrix so all entries are 1 Leads to identity matrix instead of upper triangular Backsubstitution is easy
2
Example First pivot
3
Normalize pivot row
4
Multiply 1st row by 3 and subtract from 2nd row
5
Do the other two rows Now pivot again
6
Normalize
7
Multiply 2nd row by 0.75 and subtract from first row
8
For first row and after all eliminated
9
No need to pivot, so normalize
Work on rows 1,2 and 4 with row 3
10
No rows below row 4 to pivot with, so normalize
and eliminate column 4
11
We now have our answer, since backsubstitution is trivial
12
LU decomposition - another method for solving matrix equations
Idea behind LU decomposition - start with or
13
We know (because we did it in G.E.) we can write
i.e or
14
Assume there exists [L]
such that
15
means that
16
LU method 1) factor (decompose) A into L and U 2) given b, determine d from Ld=b 3) using Ux=d and backsubstitution, solve for x Advantage: Once you have L and U, can use many different b’s
17
How do you get L and U? Gauss elimination gives you U. It also gives you L. The factors are the entries in L
18
Changes in algorithm for Gauss elimination for LU decomposition
loop over all the rows except the last one loop over all the rows below the current one get fik = aik/akk multiply row k by f and subtract from row i put fik in L at row i, column k end loop A is now upper triangular U make all Lkk=1
19
A fancier way of storing L and U
Good if n is large More overhead to sort out
20
Pivoting in LU decomposition
Still need it Messes up order of L What to do? Need to pivot also both L and a permutation matrix P
21
Initialize P as identity matrix and pivot when A is pivoted
Initialize P as identity matrix and pivot when A is pivoted. Also pivot L
22
Example Starting out
23
No pivot
24
Now exchange rows 2 and 4
25
The pivot factors are
26
No pivot again, factor
27
Now make the diagonal elements of L=1
28
Recall
30
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
31
Example (no pivoting):
32
Get d
33
Use Ux=d and backsubstitute
34
Now change b We don’t have to do elimination again Use the same L and U
35
Get d
36
Use Ux=d and backsubstitute
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.