SE301: Numerical Methods Topic 3: Solution of Systems of Linear Equations Lectures 12-17:

  • Upload
    watson

  • View
    37

  • Download
    1

Embed Size (px)

DESCRIPTION

SE301: Numerical Methods Topic 3: Solution of Systems of Linear Equations Lectures 12-17:. KFUPM Read Chapter 9 of the textbook. Lecture 12 Vector, Matrices, and Linear Equations. VECTORS. MATRICES. MATRICES. Determinant of a MATRICES. Adding and Multiplying Matrices. - PowerPoint PPT Presentation

Citation preview

  • CISE301_Topic3KFUPM * SE301: Numerical Methods Topic 3: Solution of Systems of Linear Equations Lectures 12-17: KFUPM

    Read Chapter 9 of the textbook

    KFUPM

  • CISE301_Topic3KFUPM *Lecture 12Vector, Matrices, andLinear Equations

    KFUPM

  • CISE301_Topic3KFUPM *VECTORS

    KFUPM

  • CISE301_Topic3KFUPM *MATRICES

    KFUPM

  • CISE301_Topic3KFUPM *MATRICES

    KFUPM

  • CISE301_Topic3KFUPM *Determinant of a MATRICES

    KFUPM

  • CISE301_Topic3KFUPM *Adding and Multiplying Matrices

    KFUPM

  • CISE301_Topic3KFUPM *Systems of Linear Equations

    KFUPM

  • CISE301_Topic3KFUPM *Solutions of Linear Equations

    KFUPM

  • CISE301_Topic3KFUPM *Solutions of Linear EquationsA set of equations is inconsistent if there exists no solution to the system of equations:

    KFUPM

  • CISE301_Topic3KFUPM *Solutions of Linear EquationsSome systems of equations may have infinite number of solutions

    KFUPM

  • CISE301_Topic3KFUPM *Graphical Solution of Systems ofLinear Equationssolution

    KFUPM

  • CISE301_Topic3KFUPM *Cramers Rule is Not Practical

    KFUPM

  • CISE301_Topic3KFUPM * Naive Gaussian Elimination Examples

    Lecture 13 Naive Gaussian Elimination

    KFUPM

  • CISE301_Topic3KFUPM *Naive Gaussian EliminationThe method consists of two steps:Forward Elimination: the system is reduced to upper triangular form. A sequence of elementary operations is used. Backward Substitution: Solve the system starting from the last variable.

    KFUPM

  • CISE301_Topic3KFUPM *Elementary Row Operations

    Adding a multiple of one row to another

    Multiply any row by a non-zero constant

    KFUPM

  • CISE301_Topic3KFUPM *ExampleForward Elimination

    KFUPM

  • CISE301_Topic3KFUPM *ExampleForward Elimination

    KFUPM

  • CISE301_Topic3KFUPM *ExampleForward Elimination

    KFUPM

  • CISE301_Topic3KFUPM *ExampleBackward Substitution

    KFUPM

  • CISE301_Topic3KFUPM *Forward Elimination

    KFUPM

  • CISE301_Topic3KFUPM *Forward Elimination

    KFUPM

  • CISE301_Topic3KFUPM *Backward Substitution

    KFUPM

  • CISE301_Topic3KFUPM * Summary of the Naive Gaussian Elimination Example How to check a solution Problems with Naive Gaussian Elimination Failure due to zero pivot element ErrorLecture 14Naive Gaussian Elimination

    KFUPM

  • CISE301_Topic3KFUPM *Naive Gaussian EliminationThe method consists of two stepsForward Elimination: the system is reduced to upper triangular form. A sequence of elementary operations is used.

    Backward Substitution: Solve the system starting from the last variable. Solve for xn ,xn-1,x1.

    KFUPM

  • CISE301_Topic3KFUPM *Example 1

    KFUPM

  • CISE301_Topic3KFUPM *Example 1

    KFUPM

  • CISE301_Topic3KFUPM *Example 1Backward Substitution

    KFUPM

  • CISE301_Topic3KFUPM *How Do We Know If a Solution is Good or NotGiven AX=BX is a solution if AX-B=0Due to computation error AX-B may not be zeroCompute the residuals R=|AX-B|One possible test is ?????

    KFUPM

  • CISE301_Topic3KFUPM *Determinant

    KFUPM

  • CISE301_Topic3KFUPM *How Many Solutions Does a System of Equations AX=B Have?

    KFUPM

  • CISE301_Topic3KFUPM *Examples

    KFUPM

  • CISE301_Topic3KFUPM *Lectures 15-16:Gaussian Elimination with Scaled Partial Pivoting Problems with Naive Gaussian Elimination Definitions and Initial step Forward Elimination Backward substitution Example

    KFUPM

  • CISE301_Topic3KFUPM *Problems with Naive Gaussian EliminationThe Naive Gaussian Elimination may fail for very simple cases. (The pivoting element is zero).

    Very small pivoting element may result in serious computation errors

    KFUPM

  • CISE301_Topic3KFUPM *Example 2

    KFUPM

  • CISE301_Topic3KFUPM *Example 2Initialization stepScale vector:disregard sign find largest in magnitude in each row

    KFUPM

  • CISE301_Topic3KFUPM *Why Index Vector?Index vectors are used because it is much easier to exchange a single index element compared to exchanging the values of a complete row.In practical problems with very large N, exchanging the contents of rows may not be practical since they could be stored at different locations.

    KFUPM

  • CISE301_Topic3KFUPM *Example 2Forward Elimination-- Step 1: eliminate x1

    KFUPM

  • CISE301_Topic3KFUPM *Example 2Forward Elimination-- Step 1: eliminate x1First pivot equation

    KFUPM

  • CISE301_Topic3KFUPM *Example 2Forward Elimination-- Step 2: eliminate x2

    KFUPM

  • CISE301_Topic3KFUPM *Example 2Forward Elimination-- Step 2: eliminate x2

    KFUPM

  • CISE301_Topic3KFUPM *Example 2Forward Elimination-- Step 3: eliminate x3Third pivot equation

    KFUPM

  • CISE301_Topic3KFUPM *Example 2Backward Substitution

    KFUPM

  • CISE301_Topic3KFUPM *Example 3

    KFUPM

  • CISE301_Topic3KFUPM *Example 3Initialization step

    KFUPM

  • CISE301_Topic3KFUPM *Example 3Forward Elimination-- Step 1: eliminate x1

    KFUPM

  • CISE301_Topic3KFUPM *Example 3Forward Elimination-- Step 1: eliminate x1

    KFUPM

  • CISE301_Topic3KFUPM *Example 3Forward Elimination-- Step 2: eliminate x2

    KFUPM

  • CISE301_Topic3KFUPM *Example 3Forward Elimination-- Step 2: eliminate x2

    KFUPM

  • CISE301_Topic3KFUPM *Example 3Forward Elimination-- Step 2: eliminate x2

    KFUPM

  • CISE301_Topic3KFUPM *Example 3Forward Elimination-- Step 3: eliminate x3

    KFUPM

  • CISE301_Topic3KFUPM *Example 3Forward Elimination-- Step 3: eliminate x3

    KFUPM

  • CISE301_Topic3KFUPM *Example 3Backward Substitution

    KFUPM

  • CISE301_Topic3KFUPM *How Good is the Solution?

    KFUPM

  • CISE301_Topic3KFUPM *Remarks: We use index vector to avoid the need to move the rows which may not be practical for large problems.If we order the equation as in the last value of the index vector, we have a triangular form. Scale vector is formed by taking maximum in magnitude in each row. Scale vector do not change.The original matrices A and B are used in checking the residuals.

    KFUPM

  • CISE301_Topic3KFUPM *Lecture 17 Tridiagonal & Banded Systems and Gauss-Jordan Method Tridiagonal Systems Diagonal Dominance Tridiagonal Algorithm Examples Gauss-Jordan Algorithm

    KFUPM

  • CISE301_Topic3KFUPM *Tridiagonal Systems: The non-zero elements are in the main diagonal, super diagonal and subdiagonal.aij=0 if |i-j| > 1

    Tridiagonal Systems

    KFUPM

  • CISE301_Topic3KFUPM *Occur in many applicationsNeeds less storage (4n-2 compared to n2 +n for the general cases)Selection of pivoting rows is unnecessary (under some conditions)Efficiently solved by Gaussian elimination

    Tridiagonal Systems

    KFUPM

  • CISE301_Topic3KFUPM *Based on Naive Gaussian elimination. As in previous Gaussian elimination algorithmsForward elimination stepBackward substitution stepElements in the super diagonal are not affected. Elements in the main diagonal, and B need updating

    Algorithm to Solve Tridiagonal Systems

    KFUPM

  • CISE301_Topic3KFUPM *Tridiagonal System

    KFUPM

  • CISE301_Topic3KFUPM *Diagonal Dominance

    KFUPM

  • CISE301_Topic3KFUPM *Diagonal Dominance

    KFUPM

  • CISE301_Topic3KFUPM *Diagonally Dominant Tridiagonal SystemA tridiagonal system is diagonally dominant if

    Forward Elimination preserves diagonal dominance

    KFUPM

  • CISE301_Topic3KFUPM *Solving Tridiagonal System

    KFUPM

  • CISE301_Topic3KFUPM *Example

    KFUPM

  • CISE301_Topic3KFUPM *Example

    KFUPM

  • CISE301_Topic3KFUPM *ExampleBackward SubstitutionAfter the Forward Elimination:

    Backward Substitution:

    KFUPM

  • CISE301_Topic3KFUPM *Gauss-Jordan MethodThe method reduces the general system of equations AX=B to IX=B where I is an identity matrix.

    Only Forward elimination is done and no substitution is needed.

    It has the same problems as Naive Gaussian elimination and can be modified to do partial scaled pivoting.

    It takes 50% more time than Naive Gaussian method.

    KFUPM

  • CISE301_Topic3KFUPM *Gauss-Jordan MethodExample

    KFUPM

  • CISE301_Topic3KFUPM *Gauss-Jordan MethodExample

    KFUPM

  • CISE301_Topic3KFUPM *Gauss-Jordan MethodExample

    KFUPM

  • CISE301_Topic3KFUPM *Gauss-Jordan MethodExample

    KFUPM

    ************************************************************************