420 likes | 524 Views
Today’s class. Briefly summarize the first two parts Error analysis Roots of equation Linear Algebraic Equations Gauss Elimination. Error Analysis. Round-off errors are caused because exact numbers cannot be expressed in a fixed number of digits as with computer representations
E N D
Today’s class • Briefly summarize the first two parts • Error analysis • Roots of equation • Linear Algebraic Equations • Gauss Elimination Prof. Jinbo Bi CSE, UConn
Error Analysis • Round-off errors are caused because exact numbers cannot be expressed in a fixed number of digits as with computer representations • Round-off errors occurs from imprecision in representation of data • Truncation errors result from a numerical approximation in place of an exact analytical formula • Finite divided difference, Infinite series Prof. Jinbo Bi CSE, UConn
Roots of equations • Bisection • 2 initial guesses, slow convergence, will notdiverge • False-position • 2 initial guesses, slow-medium convergence,will not diverge Prof. Jinbo Bi CSE, UConn
Roots of equations • Newton-Raphson • 1 initial guess, fast convergence, maydiverge • Secant • 2 initial guesses, medium-fast convergence, may diverge Prof. Jinbo Bi CSE, UConn
Roots of equations • Muller • 3 initial guesses, medium-fast convergence,may diverge, only polynomials, complexroots • Bairstow • 2 initial guesses, medium-fast convergence,may diverge, only polynomials, complex roots Prof. Jinbo Bi CSE, UConn
Linear Algebraic Equations • Solving for roots gave us solutions to equations of the form: • A more general problem would be to solve the following n equations simultaneously Prof. Jinbo Bi CSE, UConn 6
Linear Algebraic Equations • A linear algebraic system is a system of equations where all the functions are linear Prof. Jinbo Bi CSE, UConn
Linear Algebraic Equations • Graphical solutions • Plot the functions and the solution is the intersection point of the functions • For two dimensional linear systems, each equation is a line • For three dimensional linear systems each equation is a plane Prof. Jinbo Bi CSE, UConn
Linear Algebraic Equations • Example: Prof. Jinbo Bi CSE, UConn
Linear Algebraic Equations • Singular system (no solution) Prof. Jinbo Bi CSE, UConn
Linear Algebraic Equations • Singular system (infinite solutions) Prof. Jinbo Bi CSE, UConn
Linear Algebraic Equations • Ill-conditioned system Prof. Jinbo Bi CSE, UConn
Linear Algebraic Equations • Graphical methods work only for second and maybe third order systems • Not precise • Useful visualization tool Prof. Jinbo Bi CSE, UConn
Linear Algebraic Equations • In matrix form • where A is a n x n matrix, and X and B are n x 1 vectors. Prof. Jinbo Bi CSE, UConn
Matrices • Definitions: • Symmetric matrix • Diagonal matrix • Identity matrix (I) Prof. Jinbo Bi CSE, UConn
Matrices • Definitions: • Upper triangular • Lower triangular • Banded • Transpose Prof. Jinbo Bi CSE, UConn
Matrix Operations • Addition • Subtraction • Multiplication Prof. Jinbo Bi CSE, UConn
Matrix operations • Addition/Subtraction - O(n2) • Multiplication - O(n3) Prof. Jinbo Bi CSE, UConn
Inverse Matrices • If A is non-singular and square, then A-1 is the inverse such that Prof. Jinbo Bi CSE, UConn
Linear algebraic equations • In matrix form • where A is a n x n matrix, and X and B are n x 1 vectors. Prof. Jinbo Bi CSE, UConn
Linear algebraic equations • We need to solve for X Prof. Jinbo Bi CSE, UConn
Linear Equations • How do we get A-1? • It is non-trivial • Not very efficient if solved by hand • Usually use other methods to solve for X • Gauss Elimination • LU Decomposition Prof. Jinbo Bi CSE, UConn
Determinants, Cramer’s Rule • Given a second-order matrix A, the determinant D is defined as follows: • Given a third-order matrix A, the determinant D is defined as follows: Prof. Jinbo Bi CSE, UConn
Determinants, Cramer’s Rule • Using determinants to solve a linear system • Cramer’s rule • Replace a column of coefficients in matrix A with the B vector and find determinant Prof. Jinbo Bi CSE, UConn
Cramer’s rule example Prof. Jinbo Bi CSE, UConn 25
Gauss Elimination • Extension of elimination of unknowns as a systematic algorithm • Two steps • Elimination of unknowns • Back substitution Prof. Jinbo Bi CSE, UConn
Gauss Elimination • Forward elimination • Eliminate x1 from row 2 • Multiply row 1 by a21/a11 Prof. Jinbo Bi CSE, UConn
Gauss Elimination • Eliminate x1 from row 2 • Subtract row 1 from row 2 • Eliminate x1 from all other rows in the same way • Then eliminate x2 from rows 3 to n and so on Prof. Jinbo Bi CSE, UConn
Gauss Elimination • Forward elimination • Back substitute to solve for x Prof. Jinbo Bi CSE, UConn
Gauss Elimination • Back substitution • In general, Prof. Jinbo Bi CSE, UConn
Gauss Elimination Prof. Jinbo Bi CSE, UConn
Gauss elimination • Computational complexity • 2n3/3 + O(n2) • three orders of increase for every order of increase in n • Most of the effort is incurred in the elimination step Prof. Jinbo Bi CSE, UConn
Gauss elimination • Things to worry about • Division by zero • Round-off error • Ill-conditioned system Prof. Jinbo Bi CSE, UConn
Gauss elimination • Ill-conditioned system example Prof. Jinbo Bi CSE, UConn
Gauss elimination • Ill-conditioned system example Prof. Jinbo Bi CSE, UConn
Gauss elimination • If the determinant is close to zero, thesystem is ill-conditioned • If the determinant is exactly zero, thesystem is singular • It is difficult to specify how close to zero, as the magnitude of the determinantcan be changed by multiplying by a constant without changing the solution Prof. Jinbo Bi CSE, UConn
Gauss elimination with pivoting • Basic idea is to remove divide by zero if a11 is zero • Swap the row with the largest element withthe top row Prof. Jinbo Bi CSE, UConn
Gauss elimination with pivoting Prof. Jinbo Bi CSE, UConn
Gauss elimination with pivoting Prof. Jinbo Bi CSE, UConn
Gauss elimination with scaling • It is sometimes useful to scale the equations so that the largest coefficient in any row is 1 • Example Prof. Jinbo Bi CSE, UConn
Gauss elimination with scaling • Example Prof. Jinbo Bi CSE, UConn
Next class • LU Decomposition • Read Chapter 10 Prof. Jinbo Bi CSE, UConn