Engineering Analysis ENG 3420 Fall 2009

Slides:



Advertisements
Similar presentations
Chapter 2 Solutions of Systems of Linear Equations / Matrix Inversion
Advertisements

Chapter: 3c System of Linear Equations
Algebraic, transcendental (i.e., involving trigonometric and exponential functions), ordinary differential equations, or partial differential equations...
Simultaneous Linear Equations
Systems of Linear Equations
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.
Part 3 Chapter 9 Gauss Elimination
Chapter 9 Gauss Elimination The Islamic University of Gaza
Major: All Engineering Majors Author(s): Autar Kaw
Lecture 11 - LU Decomposition
Chapter 9 Gauss Elimination.
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 301 Programming & Graphics Numerical Methods for Engineers Lecture 20 Solution of Linear System of Equations - Iterative Methods.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 14 Elimination Methods.
ECIV 301 Programming & Graphics Numerical Methods for Engineers Lecture 15 Solution of Systems of Equations.
1 Systems of Linear Equations (Optional) Special Matrices.
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
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Part 31 Chapter.
CE 311 K - Introduction to Computer Methods Daene C. McKinney
Major: All Engineering Majors Author(s): Autar Kaw
Chapter 8 Objectives Understanding matrix notation.
Engineering Analysis ENG 3420 Fall 2009
Copyright © 2006 The McGraw-Hill Companies, Inc. Permission required for reproduction or display. by Lale Yurttas, Texas A&M University Part 31 Linear.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
MECN 3500 Inter - Bayamon Lecture 7 Numerical Methods for Engineering MECN 3500 Professor: Dr. Omar E. Meza Castillo
ΑΡΙΘΜΗΤΙΚΕΣ ΜΕΘΟΔΟΙ ΜΟΝΤΕΛΟΠΟΙΗΣΗΣ 4. Αριθμητική Επίλυση Συστημάτων Γραμμικών Εξισώσεων Gaussian elimination Gauss - Jordan 1.
Chemical Engineering Majors Author(s): Autar Kaw
Lecture 7 - Systems of Equations CVEN 302 June 17, 2002.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 3 - Chapter 9 Linear Systems of Equations: Gauss Elimination.
Gaussian Elimination Electrical Engineering Majors Author(s): Autar Kaw Transforming Numerical Methods Education for.
Chapter 9 Gauss Elimination The Islamic University of Gaza
1 Gauss Elimination Small Matrices  For small numbers of equations, solvable by hand  Graphical  Cramer's rule  Elimination 2.
Systems of Equations and Inequalities Ryan Morris Josh Broughton.
Gaussian Elimination Industrial Engineering Majors Author(s): Autar Kaw Transforming Numerical Methods Education for.
Gaussian Elimination Mechanical Engineering Majors Author(s): Autar Kaw Transforming Numerical Methods Education for.
Lecture 6 - Single Variable Problems & Systems of Equations CVEN 302 June 14, 2002.
Part 3 Chapter 9 Gauss Elimination PowerPoints organized by Dr. Michael R. Gustafson II, Duke University All images copyright © The McGraw-Hill Companies,
Gaussian Elimination Civil Engineering Majors Author(s): Autar Kaw Transforming Numerical Methods Education for STEM.
Notes Over 4.3 Evaluate Determinants of 2 x 2 Matrices
Unit #1 Linear Systems Fall Dr. Jehad Al Dallal.
Autar Kaw Benjamin Rigsby Transforming Numerical Methods Education for STEM Undergraduates.
Matrices. Variety of engineering problems lead to the need to solve systems of linear equations matrixcolumn vectors.
Numerical Methods. Introduction Prof. S. M. Lutful Kabir, BRAC University2  One of the most popular techniques for solving simultaneous linear equations.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
1 Matrix Math ©Anthony Steed Overview n To revise Vectors Matrices.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
1 Numerical Methods Solution of Systems of Linear Equations.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 3 - Chapter 9.
Numerical Methods. Prof. S. M. Lutful Kabir, BRAC University2  One of the most popular techniques for solving simultaneous linear equations is the Gaussian.
Pitfalls of Gauss Elimination ● Division by zero (avoid by pivoting) ● Round-off errors – Important with >100 eqns – Substitute answer into original eqn.
Part 3 Chapter 9 Gauss Elimination
Chapter: 3c System of Linear Equations
Simultaneous Linear Equations
Spring Dr. Jehad Al Dallal
Gaussian Elimination.
Part 3 - Chapter 9.
Lecture 11 Matrices and Linear Algebra with MATLAB
Major: All Engineering Majors Author(s): Autar Kaw
Numerical Analysis Lecture14.
Linear Systems Numerical Methods.
4.4 Objectives Day 1: Find the determinants of 2  2 and 3  3 matrices. Day 2: Use Cramer’s rule to solve systems of linear equations. Vocabulary Determinant:
Lecture 13 Simultaneous Linear Equations – Gaussian Elimination (2) Partial Pivoting Dr .Qi Ying.
Engineering Analysis ENG 3420 Fall 2009
Matrices.
Simultaneous Linear Equations Gaussian Elimination with Partial Pivoting
Presentation transcript:

Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00

Lecture 14 Last time: Today: Next Time Solving systems of linear equations (Chapter 9) Graphical methods Cramer’s rule Gauss elimination Today: Discussion of pivoting Tri-diagonal system solver Examples Next Time LU Factorization (Chapter 10) Lecture 14 2

function x=GaussNaive(A,b) ExA=[A b]; [m,n]=size(A); q=size(b); if (m~=n) fprintf ('Error: input matrix is not square; n = %3.0f, m=%3.0f \n', n,m); End if (n~=q) fprintf ('Error: vector b has a different dimension than n; q = %2.0f \n', q); end n1=n+1; for k=1:n-1 for i=k+1:n factor=ExA(i,k)/ExA(k,k); ExA(i,k:n1)= ExA(i,k:n1)-factor*ExA(k,k:n1); x=zeros(n,1); x(n)=ExA(n,n1)/ExA(n,n); for i=n-1:-1:1 x(i) = (ExA(i,n1)-ExA(i,i+1:n)*x(i+1:n))/ExA(i,i);

>> A=[1 1 1 0 0 0 ; 0 -1 0 1 -1 0 ; 0 0 -1 0 0 1 ; 0 0 0 0 1 -1 ; 0 10 -10 0 -15 -5 ; 5 -10 0 -20 0 0] A = 1 1 1 0 0 0 0 -1 0 1 -1 0 0 0 -1 0 0 -1 0 0 0 0 1 -1 0 10 -10 0 -15 -5 5 -10 0 -20 0 0 b = [0 0 0 0 0 200] >> b=b' 200 >> x = GaussNaive(A,b) x = NaN

Pivoting If a coefficient along the diagonal is 0 (problem: division by 0) or close to 0 (problem: round-off error) then the Gauss elimination causes problems. Partial pivoting  determine the coefficient with the largest absolute value in the column below the pivot element. The rows can then be switched so that the largest element is the pivot element. Complete pivoting  check also the rows to the right of the pivot element are also checked and switch columns.

function x=GaussPartialPivot(A,b) ExtendedA=[A b]; [m,n]=size(A); q=size(b); if (m~=n) fprintf ('Error: input matrix is not square; n = %3.0f, m=%3.0f \n', n,m); End if (n~=q) fprintf ('Error: vector b has a different dimension than n; q = %2.0f \n', q); end n1=n+1; for k=1:n-1 [largest,i]=max(abs(ExtendedA(k:n,k))); nrow = i +k -1; if nrow ~=k ExtendedA([k,nrow],:) = ExtendedA([nrow,k],:); for i=k+1:n factor=ExtendedA(i,k)/ExtendedA(k,k); ExtendedA(i,k:n1)= ExtendedA(i,k:n1)-factor*ExtendedA(k,k:n1); x=zeros(n,1); x(n)=ExtendedA(n,n1)/ExtendedA(n,n); for i=n-1:-1:1 x(i) = (ExtendedA(i,n1)-ExtendedA(i,i+1:n)*x(i+1:n))/ExtendedA(i,i);

A = 1 1 1 0 0 0 0 -1 0 1 -1 0 0 0 -1 0 0 -1 0 0 0 0 1 -1 0 10 -10 0 -15 -5 5 -10 0 -20 0 0 >> k=4; n=6; A(k:n,k) ans = -20 >> k=4; n=6; A(2,k:6) 1 -1 0 >> k=4; n=6; [largest,i]=max(abs(A(k:n,k))); nrow = i +k -1, largest, i nrow =6 largest =20 i =3

Tridiagonal systems of linear equations A tridiagonal system of linear equations  a banded system with a bandwidth of 3: Can be solved using the same method as Gauss elimination, but with much less effort because most of the matrix elements are already 0.

Tridiagonal system solver