Presentation is loading. Please wait.

Presentation is loading. Please wait.

ENGR-25_Linear_Equations-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Engr/Math/Physics 25 Chp8.

Similar presentations


Presentation on theme: "ENGR-25_Linear_Equations-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Engr/Math/Physics 25 Chp8."— Presentation transcript:

1 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Engr/Math/Physics 25 Chp8 Linear Algebraic Eqns-1 Bruce Mayer, PE Registered Electrical & Mechanical Engineer BMayer@ChabotCollege.edu

2 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 2 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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

3 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 3 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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

4 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 4 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Linear Systems - Characteristics  Examine the System of Equations  We notice These Characteristics that DEFINE Linear Systems  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, e w )

5 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 5 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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

6 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 6 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods ERO Example - 1  Let’s Solve The System of Eqns  INTERCHANGE, or Swap, positions of Eqns (1) & (2)  Next SCALE by using Eqn (1) as the PIVOT To Multiply (2) by 12/6 (3) by 12/[−5]

7 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 7 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods ERO Example - 2  The Scaling Operation  Note that the 1 st 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)

8 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 8 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods ERO Example - 3  The Replacement Operation Yields Or  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 the LARGEST pivot

9 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 9 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods ERO Example - 4  Our Reduced Sys  Since |−11| > |−9.8| we do NOT need to interchange (2)↔(3)  Scale by Pivot against Eqn-(3) Or

10 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 10 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods ERO Example - 5  Perform Replacement by Subtracting (3) – (2)  Now Easily Find the Value of z from Eqn (3)  The Hard Part is DONE  Find y & x by BACK SUBSTITUTION  From Eqn (2)

11 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 11 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods ERO Example - 6  BackSub into (1)  Thus the Solution Set for Our Linear System  x = 2  y = −3  z = 5

12 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 12 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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 a loss of significance.  To reduce error, row interchanges are made to maximize the magnitude of the pivot element

13 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 13 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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

14 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 14 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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

15 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 15 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods A Singular (Inconsistent) Sys  Consider 2-Eqns in 2-Unknowns  Perform Elimination by Swapping Eqns Mult (2) by 2/1 Subtract (2) – (1)

16 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 16 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Singular System - Geometry  Plot This System on the XY Plane  The Lines do NOT CROSS to Define a A Solution Point  Singular Systems Have at least Two “PARALLEL” Eqns y

17 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 17 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods ILL-Conditioned Systems  A small deviation in one or more of the CoEfficients causes a LARGE DEVİATİON in the SOLUTİON.

18 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 18 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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 “Tilting” The Equations just a bit Dramatically Shifts the Solution (Crossing Point) Tilt Region

19 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 19 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Matrix Methods for LinSys - 1  Consider the Electrical Ckt Shown at Right  The Operation of this Ckt May be Described in Terms of the Mesh Currents, I 1 -I 4 Sources: 4 mA, 12 V Resistors: 1 & 2 kΩ  Notice Mesh Currents I 1 & I 2 are Defined by SOURCES

20 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 20 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Matrix Methods for LinSys - 3  Using Techniques from ENGR43 find  Recall Matrix Multiplication to Write the Equation system in Matrix Form

21 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 21 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Matrix Methods for LinSys - 3  Thus The (linear) Ckt Can be Described by  Where A  Coefficient Matrix –m-Rows x n-Colunms b  Constraint Vector x  Solution Vector  This Can Be Written in Std Math Notation

22 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 22 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Determinants - 1  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  D 2 is Sometimes called the “Basic Minor”

23 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 23 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Determinants - 2  Calculating Larger-Dimension DETs becomes very-Tedious very-Quickly Consider a 3x3 Det Example

24 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 24 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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 D 3ex >> A = [-4,9,6; 7,13,-2; -3,11,5]; >> D3ex = det(A) D3ex = 87 

25 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 25 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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

26 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 26 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Determinant Indicator - 2  Consider this System  Check the “Stiffness”  Thus The system appears NON-Stiff  Find Solution by Elimination as

27 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 27 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods MATLAB Left Division  MATLAB has a very nice Utility for Solving Well- Conditioned Linear Systems of the Form  Well Conditioned → Square System → No. of Eqns & Unknwns are Equal det  0  The Syntax is Quite Simple the hassle is entering the Matrix-A and Vector-b  x = A\b

28 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 28 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Left-Div Example - 1  Consider a 750 kg Crate suspended by 3 Ropes or Cables  Using Force Mechanics from ENGR36 Find 3 Eqns in 3 Unknowns

29 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 29 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Left-Div Example - 2  The MATLAB Command Window Session  Or T AB = 2.625 kN T AC = 3.816 kN T AD = 2.426 kN >> 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

30 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 30 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Matrix Inverse - 1  Recall The Matrix Formulation for n- Eqns in n-Unknowns  In Matrix Land  To Isolate x, employ the Matrix Inverse A -1 as Defined by  Use A -1 in Matrix Eqn  Note that the IDENTITY Matrix, I, Has Property

31 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 31 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Matrix Inverse - 2  Thus the Matrix Shorthand for the Solution  Determining the Inverse is NOT Trivial (Ask your MTH6 Instructor)  In addition A -1 is, in general, Less Numerically Accurate Than Pivoted Elimination  However is Symbolically Elegant and Will be Useful in that regard

32 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 32 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods 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

33 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 33 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods All Done for Today Matrix Inversion by Adjoint The “Adjoint” of a matrix is the transpose of the matrix made up of the “CoFactors” of the original matrix.  Given A, Find A -1

34 BMayer@ChabotCollege.edu ENGR-25_Linear_Equations-1.ppt 34 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Bruce Mayer, PE Licensed Electrical & Mechanical Engineer BMayer@ChabotCollege.edu Engr/Math/Physics 25 Appendix


Download ppt "ENGR-25_Linear_Equations-1.ppt 1 Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods Engr/Math/Physics 25 Chp8."

Similar presentations


Ads by Google