solving simultaneous linear equations
Post on 13-Apr-2018
247 Views
Preview:
TRANSCRIPT
-
7/27/2019 Solving Simultaneous Linear Equations
1/35
-
7/27/2019 Solving Simultaneous Linear Equations
2/35
Matrix MethodsThe solution to these sets of equations
can be solved using matrix methods. The
simultaneous solution of multipleequations finds its way in to manycommon engineering problems. In fact,modern structural engineering analysistechniques are ALL ABOUT solvingsystems of equations simultaneously.
-
7/27/2019 Solving Simultaneous Linear Equations
3/35
Matrix Methods Matrices - an organized way of presenting a set ofcoupled equations.
We seek a single unique solution that satisfies all theequations at the same time.
Consider the three coupled linear equations below:
-
7/27/2019 Solving Simultaneous Linear Equations
4/35
Matrix Methods Coupled because each equation has one or more termsin common with the others, , so that a changein one of these variables will affect more than oneequation.
Linear because each equation contains only first orderterms of . There are no terms like
Using the rules of matrix multiplication, we canrepresent the above equations in matrix form:
-
7/27/2019 Solving Simultaneous Linear Equations
5/35
Matrix Methods
-
7/27/2019 Solving Simultaneous Linear Equations
6/35
Matrix MethodsTry multiplying the matrices A and X
together, make sure you can get the original
equations above. There are several ways tosolve for unknown vector . Each methodinvolves some manipulations to thecoefficient matrix using algebraic rules,
creating a new and equivalent problem in amore easily solvable form. Thesemanipulations involve the addition of
multiples of one row to another.
-
7/27/2019 Solving Simultaneous Linear Equations
7/35
Matrix Methods
-
7/27/2019 Solving Simultaneous Linear Equations
8/35
Matrix Methods If we plot these 3 equations, the solution is the placewhere they intersect. That is, we are seeking the onepair of X1 and X2 values which lines along both or theoriginal lines (eq1, eq2).
-
7/27/2019 Solving Simultaneous Linear Equations
9/35
Gaussian Elimination
-
7/27/2019 Solving Simultaneous Linear Equations
10/35
Gaussian Elimination KEY:Whatever we do to the l.h.s. of an equation, wedo to the r.h.s. so we dont change the problem.
Lets rewrite the matrix in Eq. (4) to get one matrixwith both A and B in it:
This is called augmenting the matrix.
-
7/27/2019 Solving Simultaneous Linear Equations
11/35
Gaussian Elimination
-
7/27/2019 Solving Simultaneous Linear Equations
12/35
Gaussian Elimination Step 1: - reduce A(2,1) to zero
-
7/27/2019 Solving Simultaneous Linear Equations
13/35
Gaussian Elimination Step 2: - reduce A(3,1) to zero
-
7/27/2019 Solving Simultaneous Linear Equations
14/35
Gaussian Elimination If there were some numerical error in the computer storageof any coefficient, say the error from rounding off the -1/3currently in spot A(2,2), then when we multiply Row 2 by
some factor and add it to Row 3, we also multiply the errorby that factor.
If we can always multiply by some small number (less than1), we can reduce the propagation of that round-off error.
We can enforce this by making sure the lead coefficient(the pivot coefficient) in the pivot row has the largestabsolute value among itself and all the coefficients under it(the coefficients to be reduced to zero).
-
7/27/2019 Solving Simultaneous Linear Equations
15/35
Gaussian Elimination Since it does not matter what order I put the equationsin, we will rearrange rows when we find the currentpivot coefficient has a smaller absolute value thanthose beneath it. In the current example we have:
-
7/27/2019 Solving Simultaneous Linear Equations
16/35
Gaussian Elimination
-
7/27/2019 Solving Simultaneous Linear Equations
17/35
Gaussian Elimination Step 3: - reduce A(3,2) to zero
-
7/27/2019 Solving Simultaneous Linear Equations
18/35
Gaussian Elimination
-
7/27/2019 Solving Simultaneous Linear Equations
19/35
Gauss-Jordan Elimination Gauss-Jordan Elimination - finding the inverse Gauss-Jordan Elimination I: For the first version of this
method, lets continue where we left off in the Gaussian
elimination example:
where Gaussian elimination is used to get the lowertriangle of zeros.
-
7/27/2019 Solving Simultaneous Linear Equations
20/35
Gauss-Jordan Elimination The idea of Gauss Jordan elimination is to continue thealgebra to get an upper triangle of zeros, until thethree equations are completely uncoupled.
Just as we worked from top to bottom to get zeros forA(2,1), A(3,1), and A(3,2) in that order, we can startworking from the bottom up to make A(2,3), A(1,3),and A(1,2) zero, in that order.
Just start with the bottom as the pivot row to zeroA(2,3), A(1,3), then switch the pivot row to the secondrow to make A(1,2) zero.
-
7/27/2019 Solving Simultaneous Linear Equations
21/35
Gauss-Jordan EliminationThe three steps to get rid of A(2,3), A(1,3),A(1,2) would be
Step 1) New Row 2 = (Row 3)(-11/6) + (Row2)
Step 2) New Row 1 = (Row 3)(1) + (Row 1)
Step 3) New Row 1 = (Row 2)(15/11) + (Row 1)
-
7/27/2019 Solving Simultaneous Linear Equations
22/35
Gauss-Jordan EliminationAnd the result is:
-
7/27/2019 Solving Simultaneous Linear Equations
23/35
Gauss-Jordan Elimination
-
7/27/2019 Solving Simultaneous Linear Equations
24/35
Gauss-Seidal Method
http://numericalmethods.eng.usf.edu
An iterativemethod.
Basic Procedure:
Algebraically solve each linear equation for xi
Assume an initial guess solution array
Solve for each xiand repeat
-Use absolute relative approximate error after each iteration
to check if error is within a pre-specified tolerance.
-
7/27/2019 Solving Simultaneous Linear Equations
25/35
Gauss-Seidal MethodAlgorithm
A set of nequations and nunknowns:
11313212111 ... bxaxaxaxa nn
2323222121 ... bxaxaxaxa n2n
nnnnnnn bxaxaxaxa ...332211
. .
. .
. .
If:the diagonal elements arenon-zero
Rewriteeach equation solvingfor the corresponding unknown
ex:
First equation, solve for x1
Second equation, solve for x2
-
7/27/2019 Solving Simultaneous Linear Equations
26/35
Gauss-Seidal MethodAlgorithmGeneral Form for any row i
.,,2,1,
1
nia
xac
xii
n
ijj
jiji
i
How or where can this equation be used?
-
7/27/2019 Solving Simultaneous Linear Equations
27/35
Gauss-Seidal MethodSolve for the unknowns
Assume an initial guess for [X]
n
-n
2
x
x
x
x
1
1
Use rewritten equations to solve for
each value of xi.
Important: Remember to use the
most recent value of xi. Which
means to apply values calculated to
the calculations remaining in the
currentiteration.
-
7/27/2019 Solving Simultaneous Linear Equations
28/35
Gauss-Seidal MethodGiven the system of equations
15x-3x12x321
283x5xx 321 7613x7x3x 321
1
0
1
3
2
1
x
x
x
With an initial guess of
The coefficient matrix is:
1373
351
5312
A
Will the solution converge using the
Gauss-Siedel method?
-
7/27/2019 Solving Simultaneous Linear Equations
29/35
Gauss-Seidal Method:
Example
1373
351
5312
A
Checking if the coefficient matrix is diagonally dominant
43155232122
aaa
10731313 323133 aaa
8531212 131211 aaa
The inequalities are all true and at least one row is strictlygreater than:
Therefore: The solution should converge using the Gauss-Siedel Method
-
7/27/2019 Solving Simultaneous Linear Equations
30/35
Gauss-Seidal Method :
Example
7628
1
1373351
5312
3
2
1
aa
a
Rewriting each equation
12
531 321
xxx
5
328 312
xxx
13
7376 213
xxx
With an initial guess of
10
1
3
2
1
xx
x
50000.0
12
150311
x
9000.45135.028
2
x
0923.3
13
9000.4750000.03763
x
-
7/27/2019 Solving Simultaneous Linear Equations
31/35
Gauss-Seidal Method:
ExampleThe absolute relative approximate error%662.67100
50000.0
0000.150000.01a
%00.1001009000.4
09000.42a
%662.671000923.3
0000.10923.33a
The maximum absolute relative error after the first iteration is 100%
-
7/27/2019 Solving Simultaneous Linear Equations
32/35
Gauss-Seidal Method:
Example
8118.3
7153.3
14679.0
3
2
1
x
x
x
After Iteration #1
14679.0
12
0923.359000.4311
x
7153.35
0923.3314679.0282 x
8118.3
13
900.4714679.03763
x
Substituting the x values into the equationsAfter Iteration #2
0923.3
9000.4
5000.0
3
2
1
x
x
x
-
7/27/2019 Solving Simultaneous Linear Equations
33/35
Gauss-Seidal Method:
ExampleIteration #2 absolute relative approximate error%62.240100
14679.0
50000.014679.01
a
%887.311007153.3
9000.47153.32
a
%876.181008118.3
0923.38118.33
a
The maximum absolute relative error after the first iteration is 240.62%
This is much larger than the maximum absolute relative error obtained in
iteration #1. Is this a problem?
-
7/27/2019 Solving Simultaneous Linear Equations
34/35
Gauss-Seidal Method:
ExampleRepeating more iterations, the following values are obtained1a
2a
3a
Iteration a
1 a
2 a
3
1
23
4
5
6
0.50000
0.146790.74275
0.94675
0.99177
0.99919
67.662
240.6280.23
21.547
4.5394
0.74260
4.900
3.71533.1644
3.0281
3.0034
3.0001
100.00
31.88717.409
4.5012
0.82240
0.11000
3.0923
3.81183.9708
3.9971
4.0001
4.0001
67.662
18.8764.0042
0.65798
0.07499
0.00000
4
3
1
3
2
1
x
x
x
0001.4
0001.3
99919.0
3
2
1
x
x
x
The solution obtained
is close to the exact solution of
-
7/27/2019 Solving Simultaneous Linear Equations
35/35
REFERENCES: http://numericalmethods.eng.usf.edu
http://www.essie.ufl.edu/~kgurl/Classes/Lect3421/NM2_matrix_s02.pdf
Numerical Methods Lecture 2 Simultaneous Equations
http://numericalmethods.eng.usf.edu/http://www.essie.ufl.edu/~kgurl/Classes/Lect3421/NM2_matrix_s02.pdfhttp://www.essie.ufl.edu/~kgurl/Classes/Lect3421/NM2_matrix_s02.pdfhttp://www.essie.ufl.edu/~kgurl/Classes/Lect3421/NM2_matrix_s02.pdfhttp://www.essie.ufl.edu/~kgurl/Classes/Lect3421/NM2_matrix_s02.pdfhttp://www.essie.ufl.edu/~kgurl/Classes/Lect3421/NM2_matrix_s02.pdfhttp://www.essie.ufl.edu/~kgurl/Classes/Lect3421/NM2_matrix_s02.pdfhttp://www.essie.ufl.edu/~kgurl/Classes/Lect3421/NM2_matrix_s02.pdfhttp://www.essie.ufl.edu/~kgurl/Classes/Lect3421/NM2_matrix_s02.pdfhttp://www.essie.ufl.edu/~kgurl/Classes/Lect3421/NM2_matrix_s02.pdfhttp://numericalmethods.eng.usf.edu/
top related