Assignment2 Santos CarlosJoaquin MECp1
Assignment2 Santos CarlosJoaquin MECp1
Assignment2 Santos CarlosJoaquin MECp1
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𝑥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𝑥10−3
0 0 −4 0 8 0 0 0 −2 −2√3 0
−3
0 0 0 0 0 12 0 0 −2√3 −6 −4𝑥10
−2 2√3 −2 −2√3 0 0 12 0 −4 0 0
−4𝑥10−3
2√3 −6 −2√3 −6 0 0 0 12 0 0
0
0 0 −2 2√3 −2 −2√3 −4 0 12 0 [−4𝑥10−3 ]
[ 0 0 2√3 −2√3 −2√3 −6 0 0 0 12 ]
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(𝑟𝑜𝑤7) + (𝑟𝑜𝑤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𝑥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𝑥10−3
0 0 −4 0 8 0 0 0 −2 −2√3 0
−3
0 0 0 0 0 12 0 0 −2√3 −6 −4𝑥10
−2 2√3 −2 −2√3 0 0 12 0 −4 0 0
−4𝑥10−3
0 0 −4√3 −12 0 0 12√3 12 −4√3 0
0
0 0 −2 2√3 −2 −2√3 −4 0 12 0 [−4𝑥10−3 ]
[0 0 2√3 −2√3 −2√3 −6 0 0 0 12 ]
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.
𝑟𝑜𝑤1 + 4(𝑟𝑜𝑤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𝑥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𝑥10−3
0 0 −4 0 8 0 0 0 −2 −2√3 0
−3
0 0 0 0 0 12 0 0 −2√3 −6 −4𝑥10
0 8√3 −12 −8√3 0 0 46 2√3 −16 0 0
−4𝑥10−3
0 0 −4√3 −12 0 0 12√3 12 −4√3 0
0
0 0 −2 2√3 −2 −2√3 −4 0 12 0 [−4𝑥10−3 ]
[0 0 2√3 −2√3 −2√3 −6 0 0 0 12 ]
Result when the values below the pivot in column 1 and column 2 are eliminated:
𝑟𝑜𝑤1 − 𝑟𝑜𝑤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𝑥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𝑥10−3
0 0 0 0 −8 0 −2 2√3 2 2√3 0
0 0 0 0 0 12 0 0 −2√3 −6 −4𝑥10−3
0 0 144 −96√3 0 0 −504 −72√3 192 0 −0.05542562584
−4𝑥10−3
0 0 −4√3 −12 0 0 12√3 12 −4√3 0
0
0 0 −2 2√3 −2 −2√3 −4 0 12 0 [ −4𝑥10−3 ]
[0 0 2√3 −2√3 −2√3 −6 0 0 0 12 ]
8 0 −4 0 0 0 −2 2√3 0 0 0
0 12 0 0 0 0 2√3 −6 0 0 −4𝑥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𝑥10−3
0 0 0 0 −8 0 −2 2√3 2 2√3 0
0 0 0 0 0 12 0 0 −2√3 −6 −4𝑥10−3
−.1108512517
0 0 0 0 0 0 −624 −48√3 240 −48√3
−0.032
0 0 0 0 0 0 0 36 10√3 −42 −46.55752569
0 0 0 0 0 0 0 0 23040 −103756.7716 [−791.0278392]
[0 0 0 0 0 0 0 0 0 537079.7038 ]
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𝑥10 = −791.0278392
−3
𝑥𝑥10 −1.4728𝑥10−3
= −1.4728𝑥10
10 =
23040𝑥9 − 103756.7716𝑥10 = −46.55752569
𝑥9 = 4.6119𝑥10−3
𝑥8 = −3.6189𝑥10−3
𝑥7 = 4.9403𝑥10−6
𝑥6 = −1.7343𝑥10−3
𝑥5 = −8.6343𝑥10−4
𝑥4 = −2.9962𝑥10−3
20𝑥3 − 8𝑥5 − 6𝑥7 − 2√3𝑥8 − 4𝑥9 + 4√3𝑥10 = 0
𝑥3 = −1.8012𝑥10−4
𝑥2 = −2.5812𝑥10−3
𝑥1 = 1. 9872𝑥10−3
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)