Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chem 302 - Math 252 Chapter 2 Solutions of Systems of Linear Equations / Matrix Inversion.

Similar presentations


Presentation on theme: "Chem 302 - Math 252 Chapter 2 Solutions of Systems of Linear Equations / Matrix Inversion."— Presentation transcript:

1 Chem 302 - Math 252 Chapter 2 Solutions of Systems of Linear Equations / Matrix Inversion

2 Solutions of Systems of Linear Equations n linear equations, n unknowns Three possibilities –Unique solution –No solution –Infinite solutions Numerically systems that are almost singular cause problems –Range of solutions –Ill-conditioned problem Singular Systems

3

4

5

6

7 Solutions of Systems of Linear Equations Direct Methods –Determine solution in finite number of steps –Usually preferred –Round-off error can cause problems Indirect Methods –Use iteration scheme –Require infinite operations to determine exact solution –Useful when Direct Methods fail

8 Direct Methods Cramer’s Rule Gaussian Elimination Gauss-Jordan Elimination –Maximum Pivot Strategy

9 Cramer’s Rule 1.Write coefficient matrix (A) 2.Evaluate |A| –If |A|=0 then singular 3.Form A 1 –Replace column 1 of A with answer column 4.Compute x 1 = |A 1 |/|A| 5.Repeat 3 and 4 for other variables

10 Cramer’s Rule Not singular: System has unique solution

11 Cramer’s Rule

12 Good for small systems Good if only one or two variables are needed Very slow and inefficient for large systems –n order system requires (n+1)! × & (n+1)! Additions 2 nd order 6 ×, 6 + 10 th order 3628800 ×, 3628800 + 600 th order 1.27×10 1408 ×, 1.27×10 1408 +

13 Gaussian Elimination 1.Form augmented matrix 2.Use elementary row operations to transform the augmented matrix so that the A portion is in upper triangular form Switch rows Multiply row by constant Linear combination of rows 3.Use back substitution to find solutions Requires  n 3 +n 2 -  n ×,  n 3 +½n 2 -  n +

14 Gaussian Elimination

15 Gauss-Jordan Elimination 1.Form augmented matrix 2.Normalize 1 st row 3.Use elementary row operations to transform the augmented matrix so that the A portion is the identity matrix Switch rows Multiply row by constant Linear combination of rows Requires ½n 3 +n 2 - 2½n+2 ×, ½n 3 -1½n+1 + Can also be used to find matrix inverse

16 Gauss-Jordan Elimination

17 Maximum Pivot Strategy Elimination methods can run into difficulties if one or more of diagonal elements is close to (or exactly) zero Normalize row with largest (magnitude) element.

18 Gauss-Jordan Elimination

19 Comparison of Direct Methods Small systems (n<10) not a big deal Large systems critical Number of floating point operations nCramer’sGaussian EliminationGauss-Jordan Elimination 2 1297 3 482827 4 2406267 5 1440115133 10 798336008051063 20 1.0×10 20 59108323 100 1.9×10 160 6815501009603 1000 4.0×10 2570 6.7×10 8 1.0×10 9

20 Comparison of Direct Methods Time required on a 300 MFLOP computer (500 TFLOP) nCramer’sGaussian EliminationGauss-Jordan Elimination 2 2.4×10 -8 s1.8×10 -8 s1.4×10 -8 s 3 9.6×10 -8 s5.6×10 -8 s5.4×10 -8 s 4 4.8×10 -7 s1.2×10 -7 s1.3×10 -7 s 5 2.9×10 -6 s2.3×10 -7 s2.7×10 -7 s 10 0.16s1.6×10 -6 s2.1×10 -6 s 20 6475 years (2.4 days)1.2×10 -5 s1.7×10 -5 s 100 1×10 144 (1×10 138 ) years1.4×10 -3 s2.0×10 -3 s 1000 10 2554 (10 2548 ) years1.32

21 Indirect Methods Jacobi Method Gauss-Seidel Method Use iterations –Guess solution –Iterate to self consistent Can be combined with Direct Methods

22 Jacobi Method Rearrange system of equations to isolate the diagonal elements Guess solution Iterate until self-consistent

23 Jacobi Method iterationx1x2x3 0000 110.5714291.333333 21.095238 1.047619 30.9940481.0272110.968254 40.992630.9900790.998299 51.0010270.9984611.00274 61.0005351.000930.999943 70.9998771.000060.999778 80.9999650.9999191.000021 91.0000131.0000011.000017 101.0000021.0000070.999997 110.999999 1210.9999991 13111

24 Gauss-Seidel Method Same as Jacobi method, but use updated values as soon as they are calculated.

25 Jacobi Method iterationx1x2x3 0000 110.5714291.333333 21.095238 1.047619 30.9940481.0272110.968254 40.992630.9900790.998299 51.0010270.9984611.00274 61.0005351.000930.999943 70.9998771.000060.999778 80.9999650.9999191.000021 91.0000131.0000011.000017 101.0000021.0000070.999997 110.999999 1210.9999991 13111 Gauss-Seidel Method iterationx1x2x3 0000 110.7142861.031746 21.0396831.0147390.989544 30.9968510.9965631.001082 41.0005651.000390.999831 50.999930.9999421.000022 61.000011.0000080.999997 70.999999 1 8111 9111

26 Indirect Methods Sufficient condition –Diagonally dominant Large problems Sparse matrix (many zeros)


Download ppt "Chem 302 - Math 252 Chapter 2 Solutions of Systems of Linear Equations / Matrix Inversion."

Similar presentations


Ads by Google