today’s class briefly summarize the first two parts error analysis roots of equation linear...

Post on 13-Jan-2016

222 Views

Category:

Documents

3 Downloads

Preview:

Click to see full reader

TRANSCRIPT

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

• 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

• 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

• 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

• 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

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

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

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

Linear Algebraic Equations• Example:

Numerical Methods, Lecture 7 9

Prof. Jinbo Bi CSE, UConn

Linear Algebraic Equations• Singular system (no solution)

Numerical Methods, Lecture 7 10

Prof. Jinbo Bi CSE, UConn

Linear Algebraic Equations• Singular system (infinite solutions)

Numerical Methods, Lecture 7 11

Prof. Jinbo Bi CSE, UConn

Linear Algebraic Equations• Ill-conditioned system

Numerical Methods, Lecture 7 12

Prof. Jinbo Bi CSE, UConn

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

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

Matrices

• Definitions:• Symmetric matrix• Diagonal matrix• Identity matrix (I)

Numerical Methods, Lecture 7 15

Prof. Jinbo Bi CSE, UConn

Matrices• Definitions:

• Upper triangular

• Lower triangular

• Banded

• Transpose

Numerical Methods, Lecture 7 16

Prof. Jinbo Bi CSE, UConn

Matrix Operations

• Addition

• Subtraction

• Multiplication

Numerical Methods, Lecture 7 17

Prof. Jinbo Bi CSE, UConn

• Addition/Subtraction - O(n2)• Multiplication - O(n3)

Matrix operations

Numerical Methods, Lecture 7 18

Prof. Jinbo Bi CSE, UConn

• 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

• 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

• We need to solve for X

Linear algebraic equations

Numerical Methods, Lecture 7 21

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

Numerical Methods, Lecture 7 22

Prof. Jinbo Bi CSE, UConn

• 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

• 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

25

Cramer’s rule example

Numerical Methods, Lecture 7 25

Prof. Jinbo Bi CSE, UConn

• 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

• 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

• 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

• Forward elimination

• Back substitute to solve for x

Gauss Elimination

Numerical Methods, Lecture 7 29

Prof. Jinbo Bi CSE, UConn

• Back substitution

• In general,

Gauss Elimination

Numerical Methods, Lecture 7 30

Prof. Jinbo Bi CSE, UConn

Gauss Elimination

Numerical Methods, Lecture 7 31

Prof. Jinbo Bi CSE, UConn

• 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

• 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

• Ill-conditioned system example

Gauss elimination

Numerical Methods, Lecture 7 34

Prof. Jinbo Bi CSE, UConn

• Ill-conditioned system example

Gauss elimination

Numerical Methods, Lecture 7 35

Prof. Jinbo Bi CSE, UConn

• 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

• 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

Gauss elimination with pivoting

Numerical Methods, Lecture 7 38

Prof. Jinbo Bi CSE, UConn

Gauss elimination with pivoting

Numerical Methods, Lecture 7 39

Prof. Jinbo Bi CSE, UConn

• 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

• Example

Gauss elimination with scaling

Numerical Methods, Lecture 7 41

Prof. Jinbo Bi CSE, UConn

Next class

• LU Decomposition• Read Chapter 10

Numerical Methods, Lecture 7 42

Prof. Jinbo Bi CSE, UConn

top related