Download File - Jomar Rabajante

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
MATH 175: Numerical Analysis II
Lecturer: Jomar Fajardo Rabajante
2nd Sem AY 2012-2013
IMSP, UPLB
Numerical Methods for Linear Systems
Review (Naïve) Gaussian Elimination
Given n equations in n variables.
n 
Operation count for elimination step: O



(multiplications/divisions)
3
2
Operation count for back substitution:  n 
O 
 2
3
•
•
Numerical Methods for Linear Systems
Overall (Naïve) Gaussian Elimination takes
n
O
3
3

n
  O

 2
2

n
  O

3
3



Take note: we ignored here lower-order terms
and we did not include row exchanges and
additions/subtractions. WHAT MORE IF WE
ADDED THESE STUFFS???!!! KAPOY NA!
Numerical Methods for Linear Systems
Example: Consider 10 equations in 10
unknowns. The approximate number of
operations is
3
10
   334  
3
If our computations have round-off errors, how
would our solution be affected by error
magnification? Tsk… Tsk…
Numerical Methods for Linear Systems
Our goal now is to use methods that
will efficiently solve our linear
systems with minimized error
magnification.
1st Method: Gaussian Elimination with
Partial Pivoting
• When we are processing column i in Gaussian
elimination, the (i,i) position is called the pivot
position, and the entry in it is called the pivot
entry (or simply the pivot).
• Let [A|b] be an nx(n+1) augmented matrix.
1st Method: Gaussian Elimination with
Partial Pivoting
STEPS:
1. Begin loop (i = 1 to n–1):
2. Find the largest entry (in absolute value) in
column i from row i to row n. If the largest
value is zero, signal that a unique solution
does not exist and stop.
3. If necessary, perform a row interchange to
bring the value from step 2 into the pivot
position (i,i).
1st Method: Gaussian Elimination with
Partial Pivoting
4. For j = i+1 to n, perform
Rj 
a j,i
a i,i
Ri  R j
5. End loop.
6. If the (n,n) entry is zero, signal that a unique
solution does not exist and stop. Otherwise,
solve for the solution by back substitution.
1st Method: Gaussian Elimination with
Partial Pivoting
Example:
Original matrix (Matrix 0)
1 2 2 1 


4
4
12
12


4 8 12 8 
Matrix 1
4 4 12 12


1
2
2
1


4 8 12 8 
1st Method: Gaussian Elimination with
Partial Pivoting
Matrix 1
Matrix 2
4 4 12 12


1
2
2
1


4 8 12 8 
1
1
4
4 4 12 12


0




4
0
1st Method: Gaussian Elimination with
Partial Pivoting
Matrix 1
Matrix 2
4 4 12 12


1
2
2
1


4 8 12 8 
2
1
4
4 4 12 12


0
1




4
1
1st Method: Gaussian Elimination with
Partial Pivoting
Matrix 1
Matrix 2
4 4 12 12


1
2
2
1


4 8 12 8 
2
1
4
4 4 12 12


0
1

1




12
–1
1st Method: Gaussian Elimination with
Partial Pivoting
Matrix 1
Matrix 2
4 4 12 12


1
2
2
1


4 8 12 8 
1
1
4
4 4 12 12 


0
1

1

2




12
–2
1st Method: Gaussian Elimination with
Partial Pivoting
Matrix 1
Matrix 2
4 4 12 12


1
2
2
1


4 8 12 8 
4
4
4
4 4 12 12 


0
1

1

2


0

4
0
1st Method: Gaussian Elimination with
Partial Pivoting
Matrix 1
Matrix 2
4 4 12 12


1
2
2
1


4 8 12 8 
8
4
4
4 4 12 12 


0
1

1

2


0 4

4
4
1st Method: Gaussian Elimination with
Partial Pivoting
Matrix 1
Matrix 2
4 4 12 12


1
2
2
1


4 8 12 8 
12
4
4
4 4 12 12 


0
1

1

2


0 4 0

12
0
1st Method: Gaussian Elimination with
Partial Pivoting
Matrix 1
Matrix 2
4 4 12 12


1
2
2
1


4 8 12 8 
8
4
4
4 4 12 12 


0
1

1

2


0 4 0  4
12
–4
1st Method: Gaussian Elimination with
Partial Pivoting
Matrix 2
4 4 12 12 


0
1

1

2


0 4 0  4
Matrix 3
4 4 12 12 


0
4
0

4


0 1  1  2
1st Method: Gaussian Elimination with
Partial Pivoting
Matrix 3
4 4 12 12 


0
4
0

4


0 1  1  2
Final Matrix (Matrix 4)
4 4 12 12 


0
4
0

4


0 0  1  1
1st Method: Gaussian Elimination with
Partial Pivoting
Final Matrix
4 4 12 12 


0
4
0

4


0 0  1  1
Back substitution:
 z  1  z  1
4y  4  y  1
4x  4y  12z  12
 4x  4  12  12
 x 1
1st Method: Gaussian Elimination with
Partial Pivoting
a unique solution does not exist
0  9 12 2  1 19 12 12 

 

0
1
4

1
0
4
10

2

 

0 2  7  1 0 0 0  8
1st Method: Gaussian Elimination with
Partial Pivoting
• There are other pivoting strategies such as the
complete (or maximal) pivoting. But complete
pivoting is computationally expensive.
Related documents