1 / 28

Gauss Elimination

Gauss Elimination. บำรุง พ่วงเกิด Office: ME201 Homepage: http://www.kmitl.ac.th/~kpbumroo . เนื้อหา. การแก้สมการ สำหรับจำนวนสมการน้อยๆ (n <= 3) ใช้วิธีเขียนกราฟ Cramer’s Rule กำจัดตัวแปร Naive Gauss Elimination Pivoting Tridiagonal Systems. การแก้สมการ สำหรับจำนวนสมการน้อยๆ.

xenos
Télécharger la présentation

Gauss Elimination

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. Gauss Elimination บำรุง พ่วงเกิด Office: ME201 Homepage: http://www.kmitl.ac.th/~kpbumroo 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  2. เนื้อหา • การแก้สมการ สำหรับจำนวนสมการน้อยๆ (n <= 3) • ใช้วิธีเขียนกราฟ • Cramer’s Rule • กำจัดตัวแปร • Naive Gauss Elimination • Pivoting • Tridiagonal Systems 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  3. การแก้สมการ สำหรับจำนวนสมการน้อยๆ การเขียนกราฟ 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  4. การแก้สมการ สำหรับจำนวนสมการน้อยๆ การเขียนกราฟ 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  5. การแก้สมการ สำหรับจำนวนสมการน้อยๆ singular Ill-conditioned การเขียนกราฟ 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  6. Cramer’s Rule Cramer’s Rule 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  7. Cramer’s Rule ตัวอย่าง 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  8. The Elimination of Unknowns ตัวแปรถูกกำจัดโดยการคูณด้วยค่าคงที่ แล้วนำสมการไปลบกันทำให้ตัวแปรหายไป 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  9. Naive Gauss Elimination ขั้นตอน 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  10. Naive Gauss Elimination ขั้นตอน – forward elimination 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  11. Naive Gauss Elimination ขั้นตอน – back substitution 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  12. Naive Gauss Elimination DOFOR k = 1, n-1 DOFOR i = k+1, n factor = a(i,k)/a(k,k) DOFOR j = k+1, n a(i,j) = a(i,j) – factor*a(k,j) ENDDO b(i) = b(i) – factor*b(k) ENDDO ENDDO Pseudocode – forward elimination 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  13. Naive Gauss Elimination x(n) = b(n)/a(n,n) DOFOR i = n – 1, 1, -1 sum = b(i) DOFOR j = i + 1, n sum = sum – a(i,j)*x(j) ENDDO x(i) = sum/a(i) ENDDO Pseudocode – back substitution 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  14. Naive Gauss Elimination MatLab 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  15. Operation Counting Backwardsubstitution Forwardelimination • Flops – floating-point operations • The total effort 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  16. Pitfalls of Elimination Methods Division by zero. It is possible that during both elimination and back-substitution phases a division by zero can occur. Round-off errors. Ill-conditioned systems. Systems where small changes in coefficients result in large changes in the solution. Alternatively, it happens when two or more equations are nearly identical, resulting a wide ranges of answers to approximately satisfy the equations. Since round off errors can induce small changes in the coefficients, these changes can lead to large solution errors. 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  17. Pitfalls of Elimination Methods Singular systems. When two equations are identical, we would loose one degree of freedom and be dealing with the impossible case of n-1 equations for n unknowns. For large sets of equations, it may not be obvious however. The fact that the determinant of a singular system is zero can be used and tested by computer algorithm after the elimination stage. If a zero diagonal element is created, calculation is terminated. 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  18. Techniques for Improving Solutions • Use of more significant figures. • Pivoting. If a pivot element is zero, normalization step leads to division by zero. The same problem may arise, when the pivot element is close to zero. Problem can be avoided: • Partial pivoting. Switching the rows so that the largest element is the pivot element. • Complete pivoting. Searching for the largest element in all rows and columns then switching. 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  19. Pivoting MatLab 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  20. Gauss-Jordan • It is a variation of Gauss elimination. The major differences are: • When an unknown is eliminated, it is eliminated from all other equations rather than just the subsequent ones. • All rows are normalized by dividing them by their pivot elements. • Elimination step results in an identity matrix. • Consequently, it is not necessary to employ back substitution to obtain solution 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  21. Tridiagonal System g e f Tridiagonal System 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  22. LU Decomposition Method หลักการ 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  23. LU Decomposition Method หลักการ 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  24. Cholesky Factorization Symmetric matrix Cholesky factorization (Cholesky decomposition) 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  25. MatLab • LU Decomposition • lu(A)  U and L • d = L\b • x = U\d • Choleski Decomposition • U = chol(A) • d = U’\b • x = U\d 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  26. Iterative Methods Gauss-Siedel 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  27. Gauss-Siedel & Jacobi Iterative Gauss-Siedel Jacobi ความแตกต่าง 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

  28. Gauss-Siedel M-file 01052006 การคำนวณทางวิศวกรรม (Engineering Computation)

More Related