340 likes | 481 Views
Engr/Math/Physics 25. Chp8 Linear Algebraic Eqns-1. Bruce Mayer, PE Registered Electrical & Mechanical Engineer BMayer@ChabotCollege.edu. Learning Goals. Define Linear Algebraic Equations Solve Systems of Linear Equations by Hand using Gaussian Elimination (Elem. Row Ops) Cramer’s Method
E N D
Engr/Math/Physics 25 Chp8 LinearAlgebraic Eqns-1 Bruce Mayer, PE Registered Electrical & Mechanical EngineerBMayer@ChabotCollege.edu
Learning Goals • Define Linear Algebraic Equations • Solve Systems of Linear Equations by Hand using • Gaussian Elimination (Elem. Row Ops) • Cramer’s Method • Distinguish between Equation System Conditions: Exactly Determined, OverDetermined, UnderDetermined • Use MATLAB to Solve Systems of Eqns
Linear Equations Example • In Many Engineering Analyses (e.g. ENGR36 & ENGR43) The Engineer Must Solve Several Equations in Several Unknowns; e.g.: • Contains 3 Unknowns (x,y,z) in the 3 Equations
Examine the System of Equations Linear Systems - Characteristics • ALL the Variables are Raised EXACTLY to the Power of ONE (1) • COEFFICIENTS of the Variables are all REAL Numbers • The Eqns Contain No Transcendental Functions (e.g. ln, cos, ew) • We notice These Characteristics that DEFINE Linear Systems
Gaussian Elimination – ERO’s • A “Well Conditioned” System of Eqns can be Solved by Elementary Row Operations (ERO): • Interchanges: The vertical position of two rows can be changed • Scaling: Multiplying a row by a nonzero constant • Replacement: The row can be replaced by the sum of that row and a nonzero multiple of any other row
Let’s Solve The System of Eqns ERO Example - 1 • Next SCALE by using Eqn (1) as the PIVOT To Multiply • (2) by 12/6 • (3) by 12/[−5] • INTERCHANGE, or Swap, positions of Eqns (1) & (2)
The Scaling Operation ERO Example - 2 • Note that the 1st Coeffiecient in the Pivot Eqn is Called the Pivot Value • The Pivot is used to SCALE the Eqns Below it • Next Apply REPLACEMENT by Subtracting Eqs • (2) – (1) • (3) – (1)
The Replacement Operation Yields ERO Example - 3 • Note that the x-variable has been ELIMINATED below the Pivot Row • Next Eliminate in the “y” Column • We can use for the y-Pivot either of −11 or −9.8 • For the best numerical accuracy choose theLARGEST pivot Or
Our Reduced Sys ERO Example - 4 Or • Since |−11| > |−9.8| we do NOT need to interchange (2)↔(3) • Scale by Pivot against Eqn-(3)
Perform Replacement by Subtracting (3) – (2) ERO Example - 5 • The Hard Part is DONE • Find y & x by BACK SUBSTITUTION • From Eqn (2) • Now Easily Find the Value of z from Eqn (3)
BackSub into (1) ERO Example - 6 • x = 2 • y = −3 • z = 5 Q.E.F. • Thus the Solution Set for Our Linear System
Importance of Pivoting • Computers use finite-precision arithmetic • A small error is introduced in each arithmetic operation, AND…error propagates • When the pivot element is very small, then the multipliers will be even smaller • Adding numbers of widely differing magnitude can lead to aloss ofsignificance. • To reduce error, row interchanges are made to maximize the magnitude of the pivot element
Gaussian Elimination Summary • INTERCHANGE Eqns Such that the PIVOT Value has the Greatest Magnitude • SCALE the Eqns below the Pivot Eqn using the Pivot Value ratio’ed against the Corresponding Value below • REPLACE Eqns Below the Pivot by Subtraction to leave ZERO Coefficients Below the Pivot Value
Poorly Conditioned Systems • For Certain Systems Guassian Elimination Can Fail by • NO Solution → Singular System • Numerically Inaccurate Results → ILL-Conditioned System • In a SINGULAR SYSTEM Two or More Eqns are Scalar Multiples of each other • In ILL-Conditioned Systems 2+ Eqns are NEARLY Scalar Multiples of each other
Consider 2-Eqns in 2-Unknowns A Singular (Inconsistent) Sys • Perform Elimination by • Swapping Eqns • Mult (2) by 2/1 • Subtract (2) – (1)
Plot This System on the XY Plane y Singular System - Geometry • The Lines do NOT CROSS to Define a A Solution Point • Singular Systems Have at least Two “PARALLEL” Eqns
ILL-Conditioned Systems • A small deviation in one or more of the CoEfficients causes a LARGE DEVİATİON in the SOLUTİON.
ILL-Conditioned Systems - 2 • Systems in Which a Small Change in a CoEfficient Produces Large Changes in the Solution are said to be STIFF • Essentially the Lines Have very nearly Equal SLOPES Tilt Region • “Tilting” The Equations just a bit Dramatically Shifts the Solution (Crossing Point)
Consider the Electrical Ckt Shown at Right Matrix Methods for LinSys - 1 • The Operation of this Ckt May be Described in Terms of the • Mesh Currents, I1-I4 • Sources: 4 mA, 12 V • Resistors: 1 & 2 kΩ • Notice Mesh Currents I1 &I2are Defined by SOURCES
Using Techniques from ENGR43 find Matrix Methods for LinSys - 3 • Recall Matrix Multiplication to Write the Equation system in Matrix Form
Thus The (linear) Ckt Can be Described by Matrix Methods for LinSys - 3 • This Can Be Written in Std Math Notation • Where • A Coefficient Matrix • m-Rows x n-Colunms • b Constraint Vector • x Solution Vector
If we Solve a LinSys by Elimination we may do a Lot of work Before Discovering that the system is Singular or Very-Stiff Determinants Can Alert us ahead of time to these Difficulties Determinants are Defined only for SQUARE Arrays The 2x2 Definition Determinants - 1 • D2 is Sometimes called the “Basic Minor”
Determinants - 2 • Calculating Larger-Dimension DETs becomes very-Tedious very-Quickly • Consider a 3x3 Det • Example
Determinants - 3 • A Determinant, no matter what its size, Returns a SINGLE Value • Matrix vs. Determinant • For Square Matrix A the Notation • MATLAB vs det • The det Calc is quite Painful, but MATLAB’s “det” Fcn Makes it Easy • For the D3ex >> A = [-4,9,6; 7,13,-2; -3,11,5]; >> D3ex = det(A) D3ex = 87
Determinant Indicator - 1 • The LARGER the Magnitude of the Determinant relative to the Coefficients, The LESS-Stiff the System • If det=0, then the System is SINGULAR
Determinant Indicator - 2 • Consider this System • Check the “Stiffness” • Thus The system appears NON-Stiff • Find Solution by Elimination as
MATLAB has a very nice Utility for Solving Well-Conditioned Linear Systems of the Form MATLAB Left Division • The Syntax is Quite Simple • the hassle is entering the Matrix-A and Vector-b • x = A\b • Well Conditioned → • Square System → No. of Eqns & Unknwns are Equal • det 0
Consider a 750 kg Crate suspended by 3 Ropes or Cables Left-Div Example - 1 • Using Force Mechanics from ENGR36 Find 3 Eqns in 3 Unknowns
The MATLAB Command Window Session Left-Div Example - 2 >> A = [-0.48, 0, 0.5195;... 0.8, 0.8824, 0.7792;... -0.36, 0.4706, -.3506]; >> w = [0; 9.81*750; 0] >> T = A\w T = 1.0e+003 * 2.6254 3.8157 2.4258 • Or • TAB = 2.625 kN • TAC = 3.816 kN • TAD = 2.426 kN
Recall The Matrix Formulation for n-Eqns in n-Unknowns Matrix Inverse - 1 • Note that the IDENTITY Matrix , I, Has Property • In Matrix Land • Use A-1 in Matrix Eqn • To Isolate x, employ the Matrix Inverse A-1 as Defined by
Thus the Matrix Shorthand for the Solution Matrix Inverse - 2 • In addition A-1 is, in general, Less Numerically Accurate Than Pivoted Elimination • However • Determining the Inverse is NOT Trivial (Ask your MTH6 Instructor) is Symbolically Elegant and Will be Useful in that regard
Compare MatInv & LeftDiv % Bruce Mayer, PE % ENGR25 * 21Oct09 % file = Compare_MatInv_LeftDiv_0910 % A = [3 -7 8; 7 6 -5; -9 0 2] b = [13; -29; 37] Ainv = inv(A) xinv = Ainv*b xleft = A\b % % CHECK Both by b = A*x CHKinv = A*xinv CHKleft = A*xleft Time for Live Demo
All Done for Today • Given A, Find A-1 MatrixInversionby Adjoint The “Adjoint” of a matrix is the transpose of the matrix made up of the “CoFactors” of the original matrix.
Engr/Math/Physics 25 Appendix Time For Live Demo Bruce Mayer, PE Licensed Electrical & Mechanical EngineerBMayer@ChabotCollege.edu