{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# 11 - Solving linear systems Naive Gaussian elimination...

This preview shows pages 1–8. Sign up to view the full content.

Solving linear systems Naive Gaussian elimination Pivoting Sparse/banded matrices Performance Gaussian elimination Dhavide Aruliah UOIT MATH 2070U c D. Aruliah (UOIT) Gaussian elimination MATH 2070U 1 / 33

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Solving linear systems Naive Gaussian elimination Pivoting Sparse/banded matrices Performance Gaussian elimination 1 Solving linear systems of equations Easy-to-solve systems 2 Naive Gaussian elimination 3 Pivoting 4 Sparse and banded matrices 5 Performance of algorithms Using cputime to time programs Timed comparison of backslash vs. invert-and-multiply Operation counts c D. Aruliah (UOIT) Gaussian elimination MATH 2070U 2 / 33
Solving linear systems Naive Gaussian elimination Pivoting Sparse/banded matrices Performance Linear systems of equations Rule for matrix multiplication permits representation of linear systems of equations using matrices and vectors e.g., linear system of equations 2 x 1 + x 2 + x 3 = 4 4 x 1 + 3 x 2 + 3 x 3 + x 4 = 11 8 x 1 + 7 x 2 + 9 x 3 + 5 x 4 = 29 6 x 1 + 7 x 2 + 9 x 3 + 8 x 4 = 30 can be written as [ A ] { x } = { b } with 2 1 1 0 4 3 3 1 8 7 9 5 6 7 9 8 | {z } [ A ] x 1 x 2 x 3 x 4 | {z } { x } = 4 11 29 30 | {z } { b } c D. Aruliah (UOIT) Gaussian elimination MATH 2070U 4 / 33

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Solving linear systems Naive Gaussian elimination Pivoting Sparse/banded matrices Performance Solving linear systems of equations in M ATLAB Want to solve n × n system of linear equations [ A ] { x } = { b } Backslash operator does this in M ATLAB : >> A = [ 1 3 ; 4 7 ] >> b = [ 4; 11 ] >> x = A \ b Read x = A \ b as { x } = [ A ] - 1 { b } x = A \ b = x = mldivide(A,b) “matrix left divide” c D. Aruliah (UOIT) Gaussian elimination MATH 2070U 5 / 33
Solving linear systems Naive Gaussian elimination Pivoting Sparse/banded matrices Performance Solving linear systems in M ATLAB Present goal: to understand what \ does I Gaussian elimination I Pivoting See doc mldivide “matrix left division” Solution of [ A ] { x } = { b } Never solve linear systems by computing [ A ] - 1 and { x } = [ A ] - 1 { b } ! Use backslash ( mldivide ) or some solver enclosing sensible algorithms c D. Aruliah (UOIT) Gaussian elimination MATH 2070U 6 / 33

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Solving linear systems Naive Gaussian elimination Pivoting Sparse/banded matrices Performance Easy systems Diagonal system example Solve the linear system of equations 2 3 - 4 x 1 x 2 x 3 = 5 9 1 2 x 1 = 5 x 1 = 5 2 3 x 2 = 9 x 2 = 9 3 = 3 - 4 x 3 = 1 x 3 = - 1 4 Equations are completely decoupled c D. Aruliah (UOIT) Gaussian elimination MATH 2070U 7 / 33
Solving linear systems Naive Gaussian elimination Pivoting Sparse/banded matrices Performance Easy systems Diagonal systems Given vector { b } = [ b 1 , . . . , b n ] T R n and diagonal matrix [ D ] = diag ( { d } ) with { d } = [ d 1 , . . . , d n ] T R n , wish to solve linear system of equations [ D ] { x } = { b } , i.e., d 1 d 2 .

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}