Today’s class
description
Transcript of Today’s class
![Page 1: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/1.jpg)
Today’s class
• Briefly summarize the first two parts• Error analysis• Roots of equation
• Linear Algebraic Equations• Gauss Elimination
Numerical Methods, Lecture 7 1
Prof. Jinbo Bi CSE, UConn
![Page 2: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/2.jpg)
• 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
Error Analysis
Numerical Methods, Lecture 7 2
Prof. Jinbo Bi CSE, UConn
![Page 3: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/3.jpg)
• Bisection• 2 initial guesses, slow convergence, will not
diverge
• False-position• 2 initial guesses, slow-medium convergence,
will not diverge
Roots of equations
Numerical Methods, Lecture 7 3
Prof. Jinbo Bi CSE, UConn
![Page 4: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/4.jpg)
• Newton-Raphson• 1 initial guess, fast convergence, may
diverge
• Secant• 2 initial guesses, medium-fast convergence,
may diverge
Roots of equations
Numerical Methods, Lecture 7 4
Prof. Jinbo Bi CSE, UConn
![Page 5: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/5.jpg)
• Muller• 3 initial guesses, medium-fast convergence,
may diverge, only polynomials, complex roots
• Bairstow• 2 initial guesses, medium-fast convergence,
may diverge, only polynomials, complex roots
Roots of equations
Numerical Methods, Lecture 7 5
Prof. Jinbo Bi CSE, UConn
![Page 6: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/6.jpg)
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
6Numerical Methods, Lecture 7 6
Prof. Jinbo Bi CSE, UConn
![Page 7: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/7.jpg)
Linear Algebraic Equations• A linear algebraic system is a system of
equations where all the functions are linear
Numerical Methods, Lecture 7 7
Prof. Jinbo Bi CSE, UConn
![Page 8: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/8.jpg)
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
Numerical Methods, Lecture 7 8
Prof. Jinbo Bi CSE, UConn
![Page 9: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/9.jpg)
Linear Algebraic Equations• Example:
Numerical Methods, Lecture 7 9
Prof. Jinbo Bi CSE, UConn
![Page 10: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/10.jpg)
Linear Algebraic Equations• Singular system (no solution)
Numerical Methods, Lecture 7 10
Prof. Jinbo Bi CSE, UConn
![Page 11: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/11.jpg)
Linear Algebraic Equations• Singular system (infinite solutions)
Numerical Methods, Lecture 7 11
Prof. Jinbo Bi CSE, UConn
![Page 12: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/12.jpg)
Linear Algebraic Equations• Ill-conditioned system
Numerical Methods, Lecture 7 12
Prof. Jinbo Bi CSE, UConn
![Page 13: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/13.jpg)
Linear Algebraic Equations• Graphical methods work only for second
and maybe third order systems• Not precise• Useful visualization tool
Numerical Methods, Lecture 7 13
Prof. Jinbo Bi CSE, UConn
![Page 14: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/14.jpg)
Linear Algebraic Equations• In matrix form
• where A is a n x n matrix, and X and B are n x 1 vectors.
Numerical Methods, Lecture 7 14
Prof. Jinbo Bi CSE, UConn
![Page 15: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/15.jpg)
Matrices
• Definitions:• Symmetric matrix• Diagonal matrix• Identity matrix (I)
Numerical Methods, Lecture 7 15
Prof. Jinbo Bi CSE, UConn
![Page 16: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/16.jpg)
Matrices• Definitions:
• Upper triangular
• Lower triangular
• Banded
• Transpose
Numerical Methods, Lecture 7 16
Prof. Jinbo Bi CSE, UConn
![Page 17: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/17.jpg)
Matrix Operations
• Addition
• Subtraction
• Multiplication
Numerical Methods, Lecture 7 17
Prof. Jinbo Bi CSE, UConn
![Page 18: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/18.jpg)
• Addition/Subtraction - O(n2)• Multiplication - O(n3)
Matrix operations
Numerical Methods, Lecture 7 18
Prof. Jinbo Bi CSE, UConn
![Page 19: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/19.jpg)
• If A is non-singular and square, then A-1 is the inverse such that
Inverse Matrices
Numerical Methods, Lecture 7 19
Prof. Jinbo Bi CSE, UConn
![Page 20: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/20.jpg)
• In matrix form
• where A is a n x n matrix, and X and B are n x 1 vectors.
Linear algebraic equations
Numerical Methods, Lecture 7 20
Prof. Jinbo Bi CSE, UConn
![Page 21: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/21.jpg)
• We need to solve for X
Linear algebraic equations
Numerical Methods, Lecture 7 21
Prof. Jinbo Bi CSE, UConn
![Page 22: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/22.jpg)
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
Numerical Methods, Lecture 7 22
Prof. Jinbo Bi CSE, UConn
![Page 23: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/23.jpg)
• 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:
Determinants, Cramer’s Rule
Numerical Methods, Lecture 7 23
Prof. Jinbo Bi CSE, UConn
![Page 24: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/24.jpg)
• 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
Determinants, Cramer’s Rule
Numerical Methods, Lecture 7 24
Prof. Jinbo Bi CSE, UConn
![Page 25: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/25.jpg)
25
Cramer’s rule example
Numerical Methods, Lecture 7 25
Prof. Jinbo Bi CSE, UConn
![Page 26: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/26.jpg)
• Extension of elimination of unknowns as a systematic algorithm
• Two steps• Elimination of unknowns• Back substitution
Gauss Elimination
Numerical Methods, Lecture 7 26
Prof. Jinbo Bi CSE, UConn
![Page 27: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/27.jpg)
• Forward elimination
• Eliminate x1 from row 2• Multiply row 1 by a21/a11
Gauss Elimination
Numerical Methods, Lecture 7 27
Prof. Jinbo Bi CSE, UConn
![Page 28: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/28.jpg)
• 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
Gauss Elimination
Numerical Methods, Lecture 7 28
Prof. Jinbo Bi CSE, UConn
![Page 29: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/29.jpg)
• Forward elimination
• Back substitute to solve for x
Gauss Elimination
Numerical Methods, Lecture 7 29
Prof. Jinbo Bi CSE, UConn
![Page 30: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/30.jpg)
• Back substitution
• In general,
Gauss Elimination
Numerical Methods, Lecture 7 30
Prof. Jinbo Bi CSE, UConn
![Page 31: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/31.jpg)
Gauss Elimination
Numerical Methods, Lecture 7 31
Prof. Jinbo Bi CSE, UConn
![Page 32: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/32.jpg)
• 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
Gauss elimination
Numerical Methods, Lecture 7 32
Prof. Jinbo Bi CSE, UConn
![Page 33: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/33.jpg)
• Things to worry about• Division by zero• Round-off error• Ill-conditioned system
Gauss elimination
Numerical Methods, Lecture 7 33
Prof. Jinbo Bi CSE, UConn
![Page 34: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/34.jpg)
• Ill-conditioned system example
Gauss elimination
Numerical Methods, Lecture 7 34
Prof. Jinbo Bi CSE, UConn
![Page 35: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/35.jpg)
• Ill-conditioned system example
Gauss elimination
Numerical Methods, Lecture 7 35
Prof. Jinbo Bi CSE, UConn
![Page 36: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/36.jpg)
• If the determinant is close to zero, the system is ill-conditioned
• If the determinant is exactly zero, the system is singular
• It is difficult to specify how close to zero, as the magnitude of the determinant can be changed by multiplying by a constant without changing the solution
Gauss elimination
Numerical Methods, Lecture 7 36
Prof. Jinbo Bi CSE, UConn
![Page 37: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/37.jpg)
• Basic idea is to remove divide by zero if a11 is zero
• Swap the row with the largest element with the top row
Gauss elimination with pivoting
Numerical Methods, Lecture 7 37
Prof. Jinbo Bi CSE, UConn
![Page 38: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/38.jpg)
Gauss elimination with pivoting
Numerical Methods, Lecture 7 38
Prof. Jinbo Bi CSE, UConn
![Page 39: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/39.jpg)
Gauss elimination with pivoting
Numerical Methods, Lecture 7 39
Prof. Jinbo Bi CSE, UConn
![Page 40: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/40.jpg)
• It is sometimes useful to scale the equations so that the largest coefficient in any row is 1
• Example
Gauss elimination with scaling
Numerical Methods, Lecture 7 40
Prof. Jinbo Bi CSE, UConn
![Page 41: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/41.jpg)
• Example
Gauss elimination with scaling
Numerical Methods, Lecture 7 41
Prof. Jinbo Bi CSE, UConn
![Page 42: Today’s class](https://reader036.fdocuments.net/reader036/viewer/2022062409/56815146550346895dbf6808/html5/thumbnails/42.jpg)
Next class
• LU Decomposition• Read Chapter 10
Numerical Methods, Lecture 7 42
Prof. Jinbo Bi CSE, UConn