Professional Documents
Culture Documents
Gaussian Elimination (Matrix)
Gaussian Elimination (Matrix)
Assignment 2
Problem Title
Displacement of the Each Members of the Given Truss Solver by Gaussian Elimination
1. Problem Statement
A program that uses the Gaussian Elimination Method to solve the displacement or deformation of each
member of a given truss. Two different areas, two forces are given by the problem, modulus of elasticity and
the original length of each member are given the problem.
The first step is to analyze the given truss, as shown in image 2.1, one of the force is -1000 lb. It means
that there will be one(1) or more compression in the members of the given truss. After analyzing substitute all
the values to the given matrix.
Image 2.1
Given Matrix and Values:
[ ][ ]
By substituting all the values, the result is shown in the matrix below:
8 0 −4 0 0 0 −2 2 √3 0 0 0
0 12 0 0 0 0 2 √3 −6 0 0 −4 x 10
−3
−4 0 12 0 −4 0 −2 −2 √3 −2 2 √3 0
0 0 0 12 0 0 −2 √3 −6 2 √3 −6 −4 x 10−3
0 0 −4 0 8 0 0 0 −2 −2 √ 3 0
−2 √ 3 −6
−3
0 0 0 0 0 12 0 0 −4 x 10
−2 2 √ 3 −2 −2 √3 0 0 12 0 −4 0 0
−3
2 √ 3 −6 −2 √3 −6 0 0 0 12 0 0 −4 x 10
0 0 −2 2 √3 −2 −2 √ 3 −4 0 12 0 0
0 0 2 √ 3 −2 √3 −2 √ 3 −6 0 0 0 12 −4 x 10−3
As shown in the given matrix, all the values below the diagonal line must be equal to zero. To do that,
just like solving a linear system of equation, eliminate variables is done. In gauss elimination, all variable below
the diagonal will be eliminated to easily solve the value of X10 , since the given has 10 unknowns. The first step
is to set a formula to eliminate some value. In this case, I multiplied row 7 to √ 3 and the add it to row 8. Note
all values that are red, are the transformed row after following the formula.
√ 3 ( row 7 )+(row 8)
[ ][ ]
8 0 −4 0 0 0 −2 2√ 3 0 0 0
0 12 0 0 0 0 2√ 3 −6 0 0 −4 x 10
−3
−4 0 12 0 −4 0 −2 −2 √ 3 −2 2 √3 0
0 0 0 12 0 0 −2 √ 3 −6 2√3 −6 −4 x 10
−3
0 0 −4 0 8 0 0 0 −2 −2 √3 0
0 0 0 0 0 12 0 0 −2 √ 3 −6 −4 x 10−3
−2 2 √ 3 −2 −2 √ 3 0 0 12 0 −4 0 0
−3
0 0 −4 √ 3 −12 0 0 12 √ 3 12 −4 √3 0 −4 x 10
0 0 −2 2 √3 −2 −2 √ 3 −4 0 12 0 0
0 0 2 √3 −2 √ 3 −2 √ 3 −6 0 0 0 12 −4 x 10−3
As shown in the matrix above, row 8 column 1 is eliminated. Also, the entire row 8 values will change.
After that, repeat the process, until row 10 column 9 will be equal to zero.
row 1+ 4 (row 7)
[ ][ ]
8 0 −4 0 0 0 −2 2√3 0 0 0
0 12 0 0 0 0 2√3 −6 0 0 −4 x 10
−3
−4 0 12 0 −4 0 −2 −2 √ 3 −2 2√ 3 0
0 0 0 12 0 0 −2 √ 3 −6 2 √3 −6 −4 x 10
−3
0 0 −4 0 8 0 0 0 −2 −2 √ 3 0
0 0 0 0 0 12 0 0 −2 √3 −6 −4 x 10−3
0 8 √ 3 −12 −8 √ 3 0 0 46 2√3 −16 0 0
−3
0 0 −4 √ 3 −12 0 0 12 √ 3 12 −4 √ 3 0 −4 x 10
0 0 −2 2 √3 −2 −2 √ 3 −4 0 12 0 0
0 0 2 √3 −2 √ 3 −2 √ 3 −6 0 0 0 12 −4 x 10−3
Result when the values below the pivot in column 1 and column 2 are eliminated:
[ ][ ]
row 1−row 5
8 0 −4 0 0 0 −2 2√ 3 0 0 0
0 12 0 0 0 0 2√ 3 −6 0 0 −4 x 10
−3
0 0 20 0 −8 0 −6 −2 √ 3 −4 4 √3 0
0 0 0 12 0 0 −2 √3 −6 2 √ 3 −6 −4 x 10
−3
0 0 0 0 −8 0 −2 2√ 3 2 2 √3 0
−2 √ 3 −6
−3
0 0 0 0 0 12 0 0 −4 x 10
0 0 144 −96 √ 3 0 0 −504 −72 √ 3 192 0 −0.05542562584
0 0 −4 √ 3 −12 0 0 12 √ 3 12 −4 √3 0 −4 x 10−3
0 0 −2 2 √3 −2 −2 √ 3 −4 0 12 0 0
0 0 2 √ 3 −2 √ 3 −2 √ 3 −6 0 0 0 12 −4 x 10−3
[ ][ ]
8 0 −4 0 0 0 −2 2 √3 0 0 0
0 12 0 0 0 0 2√ 3 −6 0 0 −4 x 10
−3
0 0 20 0 −8 0 −6 −2 √ 3 −4 4 √3 0
0 0 0 12 0 0 −2 √3 −6 2√ 3 −6 −4 x 10
−3
0 0 0 0 −8 0 −2 2 √3 2 2 √3 0
−2 √3
−3
0 0 0 0 0 12 0 0 −6 −4 x 10
0 0 0 0 0 0 −624 −48 √ 3 240 −48 √ 3 −.1108512517
0 0 0 0 0 0 0 36 10 √3 −42 −0.032
0 0 0 0 0 0 0 0 23040 −103756.7716 −46.55752569
0 0 0 0 0 0 0 0 0 537079.7038 −791.0278392
After getting the final matrix, write the equation starting below the matrix and then solve for the value.
Note that the values of X1-10 in manual calculation here and the python program are not the same, because there
will be discrepancies caused by rounding off.
537079.7038 x10=−791.0278392
−3
−3
xx1010=−1.4728
=−1.4728 xx10
10
23040 x 9−103756.7716 x10 =−46.55752569
−3
x 9=4.6119 x 10
−3
x 8=−3.618 9 x 10
−6
x 7=4.9 403 x 10
−8 x 5−2 x7 −2 √ 3 x 8 +2 x 9 +2 √ 3=0
−4
x 5=−8 . 6 343 x 10
12 x 4−2 √ 3 x 7−6 x8 +2 √ 3 x 9 −6 x 10
−3
x 4 =−2. 9962 x 10
20 x 3−8 x 5−6 x 7−2 √ 3 x 8 −4 x 9 +4 √3 x 10=0
−4
x 3=−1 . 8012 x 10
12 x2 +2 √ 3 x 7−6 x8 =−4 x 10
−3
8 x 1−4 x3 −2 x 7 +2 √3 x 8=0
−3
x 1=1 . 9872 x 10
3. Problems Encountered
When coding the main program there is an error in array “TypeError: only size-1 arrays can be
converted to Python scalars solution”. I found the function np.linalg in numpy. After inputing that function, the
code successfully run.
4. References
mechtutor com. (2019b, November 20). Gauss Elimination Method Tutorial - Part 1and Part 2: Basic
print("-----Displacement of the Each Members of the Given Truss Solver by Gaussian Elimination-----")
import numpy as np
import math
print("Input Value")
E = E*10**6
x = np.linalg.solve(A, b)
print(x)