1 / 7

Chapter 3

Chapter 3. Solution of Simultaneous Linear Algebraic Equations: Lecture (III). Note: Besides the main textbook, also see Ref: Applied Numerical Methods with MATLAB for Engineers and Scientists , by S. Chapra, Ch. 9. Naïve Gauss Elimination: The general algorithm.

saddam
Download Presentation

Chapter 3

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 3 Solution of Simultaneous Linear Algebraic Equations: Lecture (III) Note: Besides the main textbook, also see Ref: Applied Numerical Methods with MATLAB for Engineers and Scientists, by S. Chapra, Ch. 9.

  2. Naïve Gauss Elimination: The general algorithm Problem: Solve a general set of n equations: a11x1+a12x2+ +a1nxn=b1(1) a21x1+a22x2+ +a2nxn=b2(2) an1x1+an2x2+ +annxn=bn(n) (I) Forward Elimination of Unknowns Step 1: Eliminate x1 from Eq. (2) through Eq. (n). Eq. (2) - (a21/a11)  Eq. (1) Eq. (n) – (an1/a11)  Eq. (1) The modified system: a11x1+a12x2+ +a1nxn=b1(1’) a’22x2+ +a’2nxn=b’2(2’) a’n2x2+ +a’nnxn=b’n(n’) Repeated

  3. Naïve Gauss Elimination: The general algorithm (cont.) Step 2: Eliminate x2 from Eq. (3’) through Eq. (n’). Eq. (3’) - (a’32/a’22)  Eq. (2’) Eq. (n’) – (a’n2/a’22)  Eq. (2’) The modified system: a11x1+a12x2+ a13x3+ +a1nxn=b1(1”) a’22x2+a’23x3+ +a’2nxn=b’2 (2”) a”33x3+ +a”3nxn=b”3 (3”) a”n3x3+ +a”nnxn=b”n(n’) Repeat the procedure … Step n-1: Eliminate xn-1 from the nth equation. Eq. (n) – (ann-1/an-1n-1)  Eq. (n-1) The modified system: a11x1+a12x2+ a13x3+ +a1nxn=b1 a’22x2+a’23x3+ +a’2nxn=b’2 a”33x3+ +a”3nxn=b”3 a(n-1)nnxn=b(n-1)n Repeated

  4. Naïve Gauss Elimination: The general algorithm (cont.) (II) Back Substitution Step 1: Solve xn from the last equation a(n-1)nnxn=b(n-1)n . xn = bn(n-1)/ann(n-1) • Note: the superscript (n-1) indicates that the elements have been modified (n-1) times. Step 2: Back-substitute the result into the (n-1)th equation to solve for xn-1; repeat forxn-2, …, x1. For example: After xn and xn-1 have been solved, xn-2 is given by xn-2=(bn-2-an-2 n-1xn-1-an-2 nxn)/an-2 n-2, or xn-2=(bn-2-[an-2 n-1 an-2 n]*[xn-1 xn]’)/an-2 n-2 (*) Note: (*) will be useful when implementing back substitution on a computer.

  5. Summary Augmented Matrix • Two phases of Gauss Elimination: • Forward elimination • Back substitution • The end result: An upper triangular system. • Your turn: How to implement Gauss elimination on a computer?

  6. Initilization: Define the original [A] and b; return the size of matrix A:[m,n]=size(A); define the augmented matrix: Aug=[A b]; set nb=n+1. Start j=1; j is the index for the unknown, xj. T j  n-1 i  n Outer Loop F Start i=j+1 Inner Loop i=i+1 T j=j+1 F End outer loop End inner loop Eliminate xj from Row i of Aug Flowchart: Forward elimination

  7. An Exercise • Example 9.3 (Ref. by Chapra): Use Gauss elimination to solve 3x1 – 0.1x2 – 0.2x3 = 7.85 0.1x1 + 7x2 – 0.3x3 = -19.3 0.3x1 – 0.2x2 + 10x3 = 71.4 • (a) By hand. Show detailed work step by step. • (b) Write an M-file MyGaussElimination.m. A copy of the code will be handed out later.

More Related