MA/CS 375 Fall 20031 MA/CS 375 Fall 2003 Lecture 19.

Slides:



Advertisements
Similar presentations
Method If an nxn matrix A has an LU-factorization, then the solution of AX = b can be determined by a Forward substitution followed by a Back substitution.
Advertisements

LU Factorization.
Block LU Factorization Lecture 24 MA471 Fall 2003.
Linear Algebra Applications in Matlab ME 303. Special Characters and Matlab Functions.
Linear Systems LU Factorization CSE 541 Roger Crawfis.
MA/CS 375 Fall MA/CS 375 Fall 2002 Lecture 18 Sit in your groups.
LU - Factorizations Matrix Factorization into Triangular Matrices.
Linear Systems COS 323. Linear Systems Solve Ax=b, where A is an n  n matrix and b is an n  1 column vectorSolve Ax=b, where A is an n  n matrix and.
MATH 685/ CSI 700/ OR 682 Lecture Notes
Scientific Computing Linear Systems – Gaussian Elimination.
Lecture 7 Intersection of Hyperplanes and Matrix Inverse Shang-Hua Teng.
LU Factorization LU-factorization Matrix factorization Forward substitution Back substitution.
Major: All Engineering Majors Authors: Autar Kaw
Grayson Ishihara Math 480 April 15,  What is Partial Pivoting?  What is the PA=LU Factorization?  What kinds of things can we use these tools.
SOLVING SYSTEMS OF LINEAR EQUATIONS. Overview A matrix consists of a rectangular array of elements represented by a single symbol (example: [A]). An individual.
CISE301_Topic3KFUPM1 SE301: Numerical Methods Topic 3: Solution of Systems of Linear Equations Lectures 12-17: KFUPM Read Chapter 9 of the textbook.
Lecture 9: Introduction to Matrix Inversion Gaussian Elimination Sections 2.4, 2.5, 2.6 Sections 2.2.3, 2.3.
Chapter 9.1 = LU Decomposition MATH 264 Linear Algebra.
Lecture 6 Matrix Operations and Gaussian Elimination for Solving Linear Systems Shang-Hua Teng.
Solution of linear system of equations
Chapter 9 Gauss Elimination The Islamic University of Gaza
1cs542g-term Notes  Assignment 1 is out (questions?)
Linear Algebraic Equations
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 17 Solution of Systems of Equations.
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Chapter 10 LU Decomposition and Matrix.
ECIV 520 Structural Analysis II Review of Matrix Algebra.
Math for CSLecture 31 LU Decomposition Pivoting Diagonalization Gram-Shcmidt Orthogonalization Lecture 3.
Algorithm for Gauss elimination 1) first eliminate for each eq. j, j=1 to n-1 for all eq.s k greater than j a) multiply eq. j by a kj /a jj b) subtract.
Mujahed AlDhaifallah (Term 342) Read Chapter 9 of the textbook
Math for CSLecture 31 LU Decomposition Pivoting Diagonalization Gram-Shcmidt Orthogonalization Lecture 3.
The Islamic University of Gaza Faculty of Engineering Civil Engineering Department Numerical Analysis ECIV 3306 Chapter 10 LU Decomposition and Matrix.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 18 LU Decomposition and Matrix Inversion.
Scientific Computing Linear Systems – LU Factorization.
Square n-by-n Matrix.
Using LU Decomposition to Optimize the modconcen.m Routine Matt Tornowske April 1, 2002.
Solving Scale Linear Systems (Example system continued) Lecture 14 MA/CS 471 Fall 2003.
F UNDAMENTALS OF E NGINEERING A NALYSIS Eng. Hassan S. Migdadi Inverse of Matrix. Gauss-Jordan Elimination Part 1.
Lesson 13-1: Matrices & Systems Objective: Students will: State the dimensions of a matrix Solve systems using matrices.
Chapter 3 Solution of Algebraic Equations 1 ChE 401: Computational Techniques for Chemical Engineers Fall 2009/2010 DRAFT SLIDES.
MA/CS 375 Fall MA/CS 375 Fall 2002 Lecture 21.
Lecture 8 Matrix Inverse and LU Decomposition
Lecture 7 - Systems of Equations CVEN 302 June 17, 2002.
Lesson 3 CSPP58001.
Direct Methods for Linear Systems Lecture 3 Alessandra Nardi Thanks to Prof. Jacob White, Suvranu De, Deepak Ramaswamy, Michal Rewienski, and Karen Veroy.
Chapter 9 Gauss Elimination The Islamic University of Gaza
ECE 530 – Analysis Techniques for Large-Scale Electrical Systems Prof. Hao Zhu Dept. of Electrical and Computer Engineering University of Illinois at Urbana-Champaign.
1/18/ LU Decomposition Industrial Engineering Majors Authors: Autar Kaw Transforming.
Linear Systems Dinesh A.
2 2.5 © 2016 Pearson Education, Ltd. Matrix Algebra MATRIX FACTORIZATIONS.
Unit #1 Linear Systems Fall Dr. Jehad Al Dallal.
Autar Kaw Benjamin Rigsby Transforming Numerical Methods Education for STEM Undergraduates.
2 - 1 Chapter 2A Matrices 2A.1 Definition, and Operations of Matrices: 1 Sums and Scalar Products; 2 Matrix Multiplication 2A.2 Properties of Matrix Operations;
Numerical Methods.  LU Decomposition is another method to solve a set of simultaneous linear equations  For most non-singular matrix [A] that one could.
Numerical Computation Lecture 6: Linear Systems – part II United International College.
1 Numerical Methods Solution of Systems of Linear Equations.
Spring Dr. Jehad Al Dallal
Linear Equations.
Linear Algebra Lecture 15.
MA/CS 375 Spring 2002 Lecture 19 MA/CS 375 Fall 2002.
RECORD. RECORD Gaussian Elimination: derived system back-substitution.
Chemical Engineering Majors Authors: Autar Kaw
Elementary Matrix Methid For find Inverse
Major: All Engineering Majors Author(s): Autar Kaw
Numerical Computation and Optimization
Numerical Analysis Lecture10.
Lecture 13 Simultaneous Linear Equations – Gaussian Elimination (2) Partial Pivoting Dr .Qi Ying.
Major: All Engineering Majors Authors: Autar Kaw
Lecture 8 Matrix Inverse and LU Decomposition
Linear Systems of Equations: solution and applications
Ax = b Methods for Solution of the System of Equations (ReCap):
Presentation transcript:

MA/CS 375 Fall MA/CS 375 Fall 2003 Lecture 19

MA/CS 375 Fall Matrices and Systems

MA/CS 375 Fall Upper Triangular Systems

MA/CS 375 Fall Upper Triangular Systems Volunteer: tell us how to solve this? (hint: this is not difficult)

MA/CS 375 Fall Example: Upper Triangular Systems

MA/CS 375 Fall Upper Triangular Systems 1) Solve the N th equation 2) Use the value from step 1 to solve the (N-1) th equation 3) Use the values from steps 1 and 2 to solve the (N-2) th equation 4) keep going until you solve the whole system.

MA/CS 375 Fall Backwards Substitution

MA/CS 375 Fall Matlab Code for Backward Substitution

MA/CS 375 Fall Testing Backwards Substitution

MA/CS 375 Fall Finite Precision Effects Notice that x(1) depends on the values of x(2),x(3),…,x(N) Remembering that round off rears its ugly head when we deal with (small+large) numbers Volunteer to design a U matrix and b vector, which do not give good answers when used in this algorithm. (goal is to give you some intuition for cases which will break an algorithm)

MA/CS 375 Fall Team Exercise Who can build a “reasonable”, non- singular, U matrix and b vector which has the worst answer for U\b 10 Minutes only

MA/CS 375 Fall LU Factorization By now you should be persuaded that it is not difficult to solve a problem of the form Lx=b or Ux=b using forward/backward elimination Suppose we are given a matrix A and we are able to find a lower triangular matrix L and an upper triangular matrix U such that: A = LU Then to solve Ax=b we can solve two simple problems: Ly = b Ux = y (sanity check LUx = L(Ux) = Ly =b)

MA/CS 375 Fall Example LU Factorization Suppose we are given: Then we can write A = LU where: Let’s check that:

MA/CS 375 Fall LU Factorization (in words) Construct a sequence of multiplier matrices (M 1, M 2, M 3, M 4,…., M N-1 ) such that: (M N-1 …. M 4 M 3 M 2 M 1 )A is upper triangle. A suitable candidate for M 1 is the matrix ( 4 by 4 case):

MA/CS 375 Fall Check to See What M 1 Does to A

MA/CS 375 Fall M 1 A Has Zeros Below The Diagonal

MA/CS 375 Fall LU Factorization cont. A suitable candidate for M 2 is the matrix ( 4 by 4 case):

MA/CS 375 Fall LU Factorization cont. A suitable candidate for M 3 is the matrix ( 4 by 4 case):

MA/CS 375 Fall LU Factorization cont. So in this case: U=(M 3 M 2 M 1 )A is upper triangle Each of the M matrices is lower triangle The inverse of M 2 looks like: Using the fact that the inverse of the each M matrix just requires us to negate the below diagonal terms A = (M 3 M 2 M 1 ) -1 U = (M 1 ) -1 (M 2 ) -1 (M 3 ) -1 U Define L = (M 1 ) -1 (M 2 ) -1 (M 3 ) -1 and we are done since the product of lower matrices is a lower matrix

MA/CS 375 Fall Matlab Routine For LU Factorization

MA/CS 375 Fall Matlab Routine For LU Factorization Build L and U A is modified in place Total cost O(N 3 ) ( we can get this by noticing the triply nested loop)

MA/CS 375 Fall Matlab Routine For LU Factorization And Solution of Ax=b Build rhs Solve Ly=b Solve Ux=y

MA/CS 375 Fall Team Exercise 1)Code up the factorization 2)Test your code to make sure it gives the correct answer as Matlab Make sure abs(LU – Aorig) is small Make sure abs(x - Aorig\b) is small 3)Make sure the routine actually finished without the break. 4)Time the code for an N=400 case 5)Compare with the timings for [Lmat,Umat] = lu(Aorig); ASK IF YOU DO NOT UNDERSTAND ANY PART OF THIS!!

MA/CS 375 Fall When Basic LU Does Not Work Remember that we are required to compute 1/A(i,i) for all the successive diagonal terms What happens when we get to the i’th diagonal term and this turns out to be 0 or very small ?? At any point we can swap the i’th row with one lower down which does not have a zero (or small entry) in the i’th column. This is known as partial pivoting.

MA/CS 375 Fall Partial Pivoting Remember before that we constructed a set of M matrices so that is upper triangle Now we construct a sequence of M matrices and P matrices so that: is upper triangle. (M N-1 …. M 4 M 3 M 2 M 1 )A (M N-1 P N-1 …. M 4 P 4 M 3 P 3 M 2 P 2 M 1 P 1 )A

MA/CS 375 Fall LU with Partial Pivoting

MA/CS 375 Fall LU with Partial Pivoting 1)find pivot 2)swap rows 3)Do elimination

MA/CS 375 Fall LU with Partial Pivoting 1)build matrix A 2)call our LU routine 3)check that: A(piv,:) = L*U 4)Looks good

MA/CS 375 Fall Team Exercise Make sure you all have a copy of the.m files on your laptops (courtesy of Coutsias) Locate GEpiv For N=100,200,400,600 –build a random NxN matrix A –time how long GEpiv takes to factorize A end Plot the cputime taken per test against N using loglog On the same graph plot N^3 using loglog Observation