1 / 23

Algorithm for Gauss elimination 1) first eliminate for each eq. j, j=1 to n-1

Algorithm for Gauss elimination 1) first eliminate for each eq. j, j=1 to n-1 for all eq.s k greater than j a) multiply eq. j by a kj /a jj b) subtract the result from eq. K This leads to upper triangular. 2) now backsubstitute a) determine x n from b) put x n into n-1 eq.

ayla
Download Presentation

Algorithm for Gauss elimination 1) first eliminate for each eq. j, j=1 to n-1

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. Algorithm for Gauss elimination • 1) first eliminate • for each eq. j, j=1 to n-1 • for all eq.s k greater than j • a) multiply eq. j by akj/ajj • b) subtract the result from eq. K • This leads to upper triangular

  2. 2) now backsubstitute • a) determine xn from • b) put xn into n-1 eq. • c) solve for xn-1 • d) repeat from b), moving back to n-2, n-3, etc. until all equations are solved

  3. Matlab code

  4. Operation counting • Important as matrix gets large • For Gauss elimination • elimination routine uses on the order of • operations • backsubstitution uses

  5. Problems with Gauss elimination (as done last time) 1) division by zero 2) round off errors 3) ill conditioned systems

  6. Division by zero Using first eq. to eliminate x1 in second eq. means dividing by 0

  7. Pivoting developed to avoid this find row with largest absolute value under pivot element switch rows More later

  8. Round off errors With more than n3/3 operations, get a lot of chopping. More important - error is propagted More than 100 equations - round can be very important - system dependent

  9. Ill conditioned systems - small changes in coefficients lead to large changes in solution Round-off errors especially important in ill-conditioned systems

  10. Recall ill conditioned system from graphical methods

  11. Can write as Since slopes are almost equal

  12. becomes

  13. Determinant close to zero indicates ill-conditioned set of equations. How close? No clear answer Problem of scale

  14. Multiply our set of equations by 100

  15. However, graphically No change

  16. Scaling Make maximum element in any row =1

  17. Another problem - singular systems Two equations in the set are the same Determinant is 0.

  18. Calculating determinant using Gauss elimination Given then

  19. How to avoid pitfalls • higher precision • pivoting • scaling

  20. Partial Pivoting Determine the largest coefficient in the column below pivot element Then switch rows (Compete pivot switches columns also, but is rarely used.)

  21. Example: Exchange rows 2 and 3 And now eliminate

  22. Algorithm for Gauss elimination using improvements • 1) first eliminate • for each eq. j, j=1 to n-1 • first scale each equation k greater than j • then pivot • now • a) multiply eq. j by akj/ajj • b) subtract the result from eq. k

  23. 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

More Related