# CISE301_Topic3KFUPM1 SE301: Numerical Methods Topic 3: Solution of Systems of Linear Equations Lectures 12-17: KFUPM Read Chapter 9 of the textbook.

## Presentation on theme: "CISE301_Topic3KFUPM1 SE301: Numerical Methods Topic 3: Solution of Systems of Linear Equations Lectures 12-17: KFUPM Read Chapter 9 of the textbook."— Presentation transcript:

CISE301_Topic3KFUPM1 SE301: Numerical Methods Topic 3: Solution of Systems of Linear Equations Lectures 12-17: KFUPM Read Chapter 9 of the textbook

CISE301_Topic3KFUPM2 Lecture 12 Vector, Matrices, and Linear Equations

CISE301_Topic3KFUPM3 VECTORS

CISE301_Topic3KFUPM4 MATRICES

CISE301_Topic3KFUPM5 MATRICES

CISE301_Topic3KFUPM6 Determinant of a MATRICES

CISE301_Topic3KFUPM8 Systems of Linear Equations

CISE301_Topic3KFUPM9 Solutions of Linear Equations

CISE301_Topic3KFUPM10 Solutions of Linear Equations  A set of equations is inconsistent if there exists no solution to the system of equations:

CISE301_Topic3KFUPM11 Solutions of Linear Equations  Some systems of equations may have infinite number of solutions

CISE301_Topic3KFUPM12 Graphical Solution of Systems of Linear Equations solution

CISE301_Topic3KFUPM13 Cramer’s Rule is Not Practical

CISE301_Topic3KFUPM14  Naive Gaussian Elimination  Examples Lecture 13 Naive Gaussian Elimination

CISE301_Topic3KFUPM15 Naive Gaussian Elimination  The 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.

CISE301_Topic3KFUPM16 Elementary Row Operations  Adding a multiple of one row to another  Multiply any row by a non-zero constant

CISE301_Topic3KFUPM17 Example Forward Elimination

CISE301_Topic3KFUPM18 Example Forward Elimination

CISE301_Topic3KFUPM19 Example Forward Elimination

CISE301_Topic3KFUPM20 Example Backward Substitution

CISE301_Topic3KFUPM21 Forward Elimination

CISE301_Topic3KFUPM22 Forward Elimination

CISE301_Topic3KFUPM23 Backward Substitution

CISE301_Topic3KFUPM24  Summary of the Naive Gaussian Elimination  Example  How to check a solution  Problems with Naive Gaussian Elimination Failure due to zero pivot element Error Lecture 14 Naive Gaussian Elimination

CISE301_Topic3KFUPM25 Naive Gaussian Elimination oThe method consists of two steps oForward Elimination: the system is reduced to upper triangular form. A sequence of elementary operations is used. oBackward Substitution: Solve the system starting from the last variable. Solve for x n,x n-1,…x 1.

CISE301_Topic3KFUPM26 Example 1

CISE301_Topic3KFUPM27 Example 1

CISE301_Topic3KFUPM28 Example 1 Backward Substitution

CISE301_Topic3KFUPM29 How Do We Know If a Solution is Good or Not  Given AX=B  X is a solution if AX-B=0  Due to computation error AX-B may not be zero  Compute the residuals R=|AX-B|  One possible test is ?????

CISE301_Topic3KFUPM30 Determinant

CISE301_Topic3KFUPM31 How Many Solutions Does a System of Equations AX=B Have?

CISE301_Topic3KFUPM32 Examples

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

CISE301_Topic3KFUPM34 Problems with Naive Gaussian Elimination oThe Naive Gaussian Elimination may fail for very simple cases. (The pivoting element is zero). oVery small pivoting element may result in serious computation errors

CISE301_Topic3KFUPM35 Example 2

CISE301_Topic3KFUPM36 Example 2 Initialization step Scale vector: disregard sign find largest in magnitude in each row

CISE301_Topic3KFUPM37 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.

CISE301_Topic3KFUPM38 Example 2 Forward Elimination-- Step 1: eliminate x1

CISE301_Topic3KFUPM39 Example 2 Forward Elimination-- Step 1: eliminate x1 First pivot equation

CISE301_Topic3KFUPM40 Example 2 Forward Elimination-- Step 2: eliminate x2

CISE301_Topic3KFUPM41 Example 2 Forward Elimination-- Step 2: eliminate x2

CISE301_Topic3KFUPM42 Example 2 Forward Elimination-- Step 3: eliminate x3 Third pivot equation

CISE301_Topic3KFUPM43 Example 2 Backward Substitution

CISE301_Topic3KFUPM44 Example 3

CISE301_Topic3KFUPM45 Example 3 Initialization step

CISE301_Topic3KFUPM46 Example 3 Forward Elimination-- Step 1: eliminate x1

CISE301_Topic3KFUPM47 Example 3 Forward Elimination-- Step 1: eliminate x1

CISE301_Topic3KFUPM48 Example 3 Forward Elimination-- Step 2: eliminate x2

CISE301_Topic3KFUPM49 Example 3 Forward Elimination-- Step 2: eliminate x2

CISE301_Topic3KFUPM50 Example 3 Forward Elimination-- Step 2: eliminate x2

CISE301_Topic3KFUPM51 Example 3 Forward Elimination-- Step 3: eliminate x3

CISE301_Topic3KFUPM52 Example 3 Forward Elimination-- Step 3: eliminate x3

CISE301_Topic3KFUPM53 Example 3 Backward Substitution

CISE301_Topic3KFUPM54 How Good is the Solution?

CISE301_Topic3KFUPM55 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.

CISE301_Topic3KFUPM56 Lecture 17 Tridiagonal & Banded Systems and Gauss-Jordan Method  Tridiagonal Systems  Diagonal Dominance  Tridiagonal Algorithm  Examples  Gauss-Jordan Algorithm

CISE301_Topic3KFUPM57 Tridiagonal Systems:  The non-zero elements are in the main diagonal, super diagonal and subdiagonal.  a ij =0 if |i-j| > 1 Tridiagonal Systems

CISE301_Topic3KFUPM58  Occur in many applications  Needs less storage (4n-2 compared to n 2 +n for the general cases)  Selection of pivoting rows is unnecessary (under some conditions)  Efficiently solved by Gaussian elimination Tridiagonal Systems

CISE301_Topic3KFUPM59  Based on Naive Gaussian elimination.  As in previous Gaussian elimination algorithms Forward elimination step Backward substitution step  Elements in the super diagonal are not affected.  Elements in the main diagonal, and B need updating Algorithm to Solve Tridiagonal Systems

CISE301_Topic3KFUPM60 Tridiagonal System

CISE301_Topic3KFUPM61 Diagonal Dominance

CISE301_Topic3KFUPM62 Diagonal Dominance

CISE301_Topic3KFUPM63 Diagonally Dominant Tridiagonal System  A tridiagonal system is diagonally dominant if  Forward Elimination preserves diagonal dominance

CISE301_Topic3KFUPM64 Solving Tridiagonal System

CISE301_Topic3KFUPM65 Example

CISE301_Topic3KFUPM66 Example

CISE301_Topic3KFUPM67 Example Backward Substitution  After the Forward Elimination:  Backward Substitution:

CISE301_Topic3KFUPM68 Gauss-Jordan Method  The 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.

CISE301_Topic3KFUPM69 Gauss-Jordan Method Example

CISE301_Topic3KFUPM70 Gauss-Jordan Method Example

CISE301_Topic3KFUPM71 Gauss-Jordan Method Example

CISE301_Topic3KFUPM72 Gauss-Jordan Method Example

Download ppt "CISE301_Topic3KFUPM1 SE301: Numerical Methods Topic 3: Solution of Systems of Linear Equations Lectures 12-17: KFUPM Read Chapter 9 of the textbook."

Similar presentations