engr/math/physics 25
DESCRIPTION
Engr/Math/Physics 25. Chp8 Linear Algebraic Eqns-1. Bruce Mayer, PE Registered Electrical & Mechanical Engineer [email protected]. Learning Goals. Define Linear Algebraic Equations Solve Systems of Linear Equations by Hand using Gaussian Elimination (Elem. Row Ops) Cramer’s Method - PowerPoint PPT PresentationTRANSCRIPT
[email protected] • ENGR-25_Linear_Equations-1.ppt1
Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods
Engr/Math/Physics 25
Chp8 LinearAlgebraic
Eqns-1Bruce Mayer, PERegistered Electrical & Mechanical Engineer
[email protected] • ENGR-25_Linear_Equations-1.ppt2
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
[email protected] • ENGR-25_Linear_Equations-1.ppt3
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.:
3146252267512141436
zyxzyxzyx
Contains 3 Unknowns (x,y,z) in the 3 Equations
[email protected] • ENGR-25_Linear_Equations-1.ppt4
Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods
Linear Systems - Characteristics Examine the
System of Equations
14625267512
41436
zyxzyx
zyx
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, ew)
[email protected] • ENGR-25_Linear_Equations-1.ppt5
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
[email protected] • ENGR-25_Linear_Equations-1.ppt6
Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods
ERO Example - 1 Let’s Solve The
System of Eqns 146253
2675122414361
zyxzyx
zyx
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]
146253
4143622675121
zyxzyxzyx
[email protected] • ENGR-25_Linear_Equations-1.ppt7
Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods
ERO Example - 2 The Scaling
Operation
146255
123
414366
122
2675121
zyx
zyx
zyx
6.334.148.4123
82861222675121
zyxzyxzyx
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)
[email protected] • ENGR-25_Linear_Equations-1.ppt8
Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods
ERO Example - 3 The Replacement
Operation Yields 6.74.78.903
1081511022675121
zyxzyx
zyx
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 theLARGEST pivot
6.74.78.93
108151122675121
zyzy
zyx
[email protected] • ENGR-25_Linear_Equations-1.ppt9
Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods
ERO Example - 4 Our Reduced Sys
6.74.78.93
108151122675121
zyzy
zyx
Since |−11| > |−9.8| we do NOT need to interchange (2)↔(3)
Scale by Pivot against Eqn-(3)
6.74.78.98.9
113
108151122675121
zy
zyzyx
Or
531.8306.8113
108151122675121
zyzy
zyx
[email protected] • ENGR-25_Linear_Equations-1.ppt10
Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods
ERO Example - 5 Perform
Replacement by Subtracting (3) – (2)
531.116306.233
108151122675121
zzy
zyx
Now Easily Find the Value of z from Eqn (3)
5306.23531.116 z
The Hard Part is DONE
Find y & x by BACK SUBSTITUTION
From Eqn (2)
31133
1175108
1115108
y
zy
[email protected] • ENGR-25_Linear_Equations-1.ppt11
Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods
ERO Example - 6 BackSub into (1)
21224
12261535
122657267512
x
yzx
zyx
Thus the Solution Set for Our Linear System
146253
2675122414361
zyxzyx
zyx
x = 2 y = −3 z = 5
[email protected] • ENGR-25_Linear_Equations-1.ppt12
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
[email protected] • ENGR-25_Linear_Equations-1.ppt13
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
[email protected] • ENGR-25_Linear_Equations-1.ppt14
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
[email protected] • ENGR-25_Linear_Equations-1.ppt15
Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods
A Singular (Inconsistent) Sys Consider 2-Eqns
in 2-Unknowns 5422
421
yx
yx
Perform Elimination by• Swapping Eqns• Mult (2) by 2/1• Subtract (2) – (1)
422
5421
yxyx
8422
5421
yxyx
3002
5421
yxyx
????302
[email protected] • ENGR-25_Linear_Equations-1.ppt16
Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods
Singular System - Geometry Plot This System
on the XY Plane 5422
421
yx
yx
The Lines do NOT CROSS to Define a A Solution Point
Singular Systems Have at least Two “PARALLEL” Eqns
y
[email protected] • ENGR-25_Linear_Equations-1.ppt17
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.
47.199.048.0321
yxyx
11
yx
47.199.049.0321
yxyx
03
yx
[email protected] • ENGR-25_Linear_Equations-1.ppt18
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
[email protected] • ENGR-25_Linear_Equations-1.ppt19
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, I1-I4
• Sources: 4 mA, 12 V• Resistors: 1 & 2 kΩ
Notice Mesh Currents I1 & I2 are Defined by SOURCES
[email protected] • ENGR-25_Linear_Equations-1.ppt20
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
mAIIImAIII
IIImAI
12208230
004000
432
432
321
1
12804
21102310
01110001
4
3
2
1
IIII
A x b
[email protected] • ENGR-25_Linear_Equations-1.ppt21
Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods
Matrix Methods for LinSys - 3 Thus The (linear)
Ckt Can be Described by
bAx Where
• A Coefficient Matrix– m-Rows x n-Colunms
• b Constraint Vector
• x Solution Vector
This Can Be Written in Std Math Notation
mnnim
iniii
ni
aaa
aaa
aaa
1
1
1111
A
m
i
x
x
x
1
x
m
i
b
b
b
1
b
[email protected] • ENGR-25_Linear_Equations-1.ppt22
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
122122112221
12112 aaaa
aaaa
D
D2 is Sometimes called the “Basic Minor”
[email protected] • ENGR-25_Linear_Equations-1.ppt23
Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods
Determinants - 2 Calculating Larger-Dimension DETs
becomes very-Tedious very-Quickly• Consider a 3x3 Det
313212111
333231
232221
131211
3 detMinordetMinordetMinor aaaaaaaaaaaa
D
2231322113233133211223323322113 aaaaaaaaaaaaaaaD
• Example
51132137
694
3
exD
87696261348
39776635922654
[email protected] • ENGR-25_Linear_Equations-1.ppt24
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
AAA det 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
[email protected] • ENGR-25_Linear_Equations-1.ppt25
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 5422
421
yx
yx SINGULAR0det
47.199.048.0321
yxyx
STIFF03.0det
47.199.049.0321
yxyx
STIFF01.0det
[email protected] • ENGR-25_Linear_Equations-1.ppt26
Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods
Determinant Indicator - 2 Consider this
System 23271325
yxyx
Check the “Stiffness” 242725
D
Thus The system appears NON-Stiff Find Solution by Elimination as
13 yx
[email protected] • ENGR-25_Linear_Equations-1.ppt27
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 bAx
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
[email protected] • ENGR-25_Linear_Equations-1.ppt28
Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods
Left-Div Example - 1 Consider a 750 kg
Crate suspended by 3 Ropes or Cables
03506.04706.036.081.9*7507792.08824.08.0
05195.0048.0
ADACAB
ADACAB
ADACAB
TTTTTT
TTT
Using Force Mechanics from ENGR36 Find 3 Eqns in 3 Unknowns
wT A
form MATRIXIn
[email protected] • ENGR-25_Linear_Equations-1.ppt29
Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods
Left-Div Example - 2 The MATLAB
Command Window Session
Or• TAB = 2.625 kN• TAC = 3.816 kN• TAD = 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\wT =
1.0e+003 * 2.6254 3.8157 2.4258
[email protected] • ENGR-25_Linear_Equations-1.ppt30
Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods
Matrix Inverse - 1 Recall The Matrix
Formulation for n-Eqns in n-UnknownsbAx
In Matrix Land
Abx To Isolate x, employ
the Matrix Inverse A-1 as Defined by
IAA 1
xIx Use A-1 in Matrix Eqn
bAxbAIxbAΑxA
1
1
11
or
or
Note that the IDENTITY Matrix , I, Has Property
[email protected] • ENGR-25_Linear_Equations-1.ppt31
Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods
Matrix Inverse - 2 Thus the Matrix
Shorthand for the Solution
bAxbAx
1
Determining the Inverse is NOT Trivial (Ask your MTH6 Instructor)
bAx 1
In addition A-1 is, in general, Less Numerically Accurate Than Pivoted Elimination
However
is Symbolically Elegant and Will be Useful in that regard
[email protected] • ENGR-25_Linear_Equations-1.ppt32
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*bxleft = A\b%% CHECK Both by b = A*xCHKinv = A*xinvCHKleft = A*xleft
[email protected] • ENGR-25_Linear_Equations-1.ppt33
Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods
All Done for Today
MatrixInversionby Adjoint
||)(1
AAA Adj
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
[email protected] • ENGR-25_Linear_Equations-1.ppt34
Bruce Mayer, PE Engineering/Math/Physics 25: Computational Methods
Bruce Mayer, PELicensed Electrical & Mechanical Engineer
Engr/Math/Physics 25
Appendix 6972 23 xxxxf