DOC PREVIEW
UCF EGN 3420 - Lecture Notes

This preview shows page 1-2-3 out of 10 pages.

Save
View full document
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Engineering Analysis ENG 3420 Fall 2009 Dan C Marinescu Office HEC 439 B Office hours Tu Th 11 00 12 00 Lecture 14 Last time Solving systems of linear equations Chapter 9 Graphical methods Cramer s rule Gauss elimination Today Discussion of pivoting Tri diagonal system solver Examples Next Time LU Factorization Chapter 10 Lecture 14 2 function x GaussNaive A b ExA A b m n size A q size b if m n fprintf Error input matrix is not square n 3 0f m 3 0f n n m End if n q fprintf Error vector b has a different dimension than n q 2 0f n q end n1 n 1 for k 1 n 1 for i k 1 n factor ExA i k ExA k k ExA i k n1 ExA i k n1 factor ExA k k n1 End End x zeros n 1 x n ExA n n1 ExA n n for i n 1 1 1 x i ExA i n1 ExA i i 1 n x i 1 n ExA i i end A 1 1 1 0 0 0 0 1 0 1 1 0 0 0 1 0 0 1 0 0 0 0 1 1 0 10 10 0 15 5 5 10 0 20 0 0 A 1 1 1 0 0 0 0 1 0 1 1 0 0 0 1 0 0 1 0 0 0 0 1 1 0 10 10 0 15 5 5 10 0 20 0 0 b 0 0 0 0 0 200 b b b 0 0 0 0 0 200 x GaussNaive A b x NaN NaN NaN NaN NaN NaN Pivoting If a coefficient along the diagonal is 0 problem division by 0 or close to 0 problem round off error then the Gauss elimination causes problems Partial pivoting determine the coefficient with the largest absolute value in the column below the pivot element The rows can then be switched so that the largest element is the pivot element Complete pivoting check also the rows to the right of the pivot element are also checked and switch columns function x GaussPartialPivot A b ExtendedA A b m n size A q size b if m n fprintf Error input matrix is not square n 3 0f m 3 0f n n m End if n q fprintf Error vector b has a different dimension than n q 2 0f n q end n1 n 1 for k 1 n 1 largest i max abs ExtendedA k n k nrow i k 1 if nrow k ExtendedA k nrow ExtendedA nrow k end end for k 1 n 1 for i k 1 n factor ExtendedA i k ExtendedA k k ExtendedA i k n1 ExtendedA i k n1 factor ExtendedA k k n1 End End x zeros n 1 x n ExtendedA n n1 ExtendedA n n for i n 1 1 1 x i ExtendedA i n1 ExtendedA i i 1 n x i 1 n ExtendedA i i end A 1 1 1 0 0 0 0 1 0 1 1 0 0 0 1 0 0 1 0 0 0 0 1 1 0 10 10 0 15 5 5 10 0 20 0 0 k 4 n 6 A k n k ans 0 0 20 k 4 n 6 A 2 k 6 ans 1 1 0 k 4 n 6 largest i max abs A k n k nrow i k 1 largest i nrow 6 largest 20 i 3 Tridiagonal systems of linear equations A tridiagonal system of linear equations a banded system with a bandwidth of 3 f1 e2 g1 f2 e3 g2 f3 g3 en 1 f n 1 en x r x 1 r1 2 2 x 3 r3 gn 1 x n 1 rn 1 f n x n rn Can be solved using the same method as Gauss elimination but with much less effort because most of the matrix elements are already 0 Tridiagonal system solver


View Full Document

UCF EGN 3420 - Lecture Notes

Download Lecture Notes
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Lecture Notes and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Lecture Notes and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?