Download presentation

Presentation is loading. Please wait.

1
Dr. Jie Zou PHY 33201 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
Dr. Jie Zou PHY 33202 Naïve Gauss Elimination: The general algorithm Problem: Solve a general set of n equations: a 11 x 1 +a 12 x 2 + +a 1n x n =b 1 (1) a 21 x 1 +a 22 x 2 + +a 2n x n =b 2 (2) a n1 x 1 +a n2 x 2 + +a nn x n =b n (n) (I) Forward Elimination of Unknowns Step 1: Eliminate x 1 from Eq. (2) through Eq. (n). Eq. (2) - (a 21 /a 11 ) Eq. (1) Eq. (n) – (a n1 /a 11 ) Eq. (1) The modified system: a 11 x 1 +a 12 x 2 + +a 1n x n =b 1 (1’) a’ 22 x 2 + +a’ 2n x n =b’ 2 (2’) a’ n2 x 2 + +a’ nn x n =b’ n (n’) Repeated

3
Dr. Jie Zou PHY 33203 Step 2: Eliminate x 2 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: a 11 x 1 +a 12 x 2 + a 13 x 3 + +a 1n x n =b 1 (1”) a’ 22 x 2 +a’ 23 x 3 + +a’ 2n x n =b’ 2 (2”) a” 33 x 3 + +a” 3n x n =b” 3 (3”) a” n3 x 3 + +a” nn x n =b” n (n’) Naïve Gauss Elimination: The general algorithm (cont.) Repeated Repeat the procedure … Step n-1: Eliminate x n-1 from the nth equation. Eq. (n) – (a nn-1 /a n-1n-1 ) Eq. (n-1) The modified system: a 11 x 1 +a 12 x 2 + a 13 x 3 + +a 1n x n =b 1 a’ 22 x 2 +a’ 23 x 3 + +a’ 2n x n =b’ 2 a” 33 x 3 + +a” 3n x n =b” 3 a (n-1) nn x n =b (n-1) n

4
Dr. Jie Zou PHY 33204 Naïve Gauss Elimination: The general algorithm (cont.) (II) Back Substitution Step 1: Solve x n from the last equation a (n-1) nn x n =b (n-1) n. x n = b n (n-1) /a nn (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 x n-1 ; repeat for x n-2, …, x 1. For example: After x n and x n-1 have been solved, x n-2 is given by x n-2 =(b n-2 -a n-2 n-1 x n-1 -a n-2 n x n )/a n-2 n-2, or x n-2 =(b n-2 -[a n-2 n-1 a n-2 n ]*[x n-1 x n ]’)/a n-2 n-2 (*) Note: (*) will be useful when implementing back substitution on a computer.

5
Dr. Jie Zou PHY 33205 Summary 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? Augmented Matrix

6
Dr. Jie Zou PHY 33206 Flowchart: Forward elimination Start j=1; j is the index for the unknown, x j. j n-1 Start i=j+1 i n T T Eliminate x j from Row i of Aug 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. i=i+1 Inner Loop End inner loop j=j+1 F F End outer loop Outer Loop

7
Dr. Jie Zou PHY 33207 An Exercise Example 9.3 (Ref. by Chapra): Use Gauss elimination to solve 3x 1 – 0.1x 2 – 0.2x 3 = 7.85 0.1x 1 + 7x 2 – 0.3x 3 = -19.3 0.3x 1 – 0.2x 2 + 10x 3 = 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.

Similar presentations

© 2019 SlidePlayer.com Inc.

All rights reserved.

To make this website work, we log user data and share it with processors. To use this website, you must agree to our Privacy Policy, including cookie policy.

Ads by Google