You are on page 1of 4

Name: Cruz, Francis Paulo M.

1st Trimester AY 2021-2022


MECp 1 -Computer Application for ME Due Date: 20 October, 2021(5:00pm)

Matrix Solution using Jacobi Method

Problem Statement

Using Jacobi method of elimination, we are tasked to find the displacement components of a
truss system in which its equilibrium equation is [𝐴]𝑥⃗ = 𝑏⃗⃗ .

A is shown as:
8 0 -4 0 0 0 -2 3.464102 0 0

0 12 0 0 0 0 3.464102 -6 0 0

-4 0 12 0 -4 0 -2 -3.4641 -2 3.464102

0 0 0 12 0 0 -3.4641 -6 3.464102 -3.4641

0 0 -4 0 8 0 0 0 -2 -3.4641

0 0 0 0 0 12 0 0 -3.4641 -6

-2 3.464102 -2 -3.4641 0 0 12 0 -4 0

3.464102 -6 3.464102 -6 0 0 0 12 0 0

0 0 -2 3.464102 -2 -3.4641 -4 0 12 0

0 0 3.464102 -3.4641 -3.4641 -6 0 0 0 12

while x and b are shown as 𝑥 = [𝑥1 , 𝑥2 , 𝑥3 , 𝑥4 , 𝑥5 , 𝑥6 , 𝑥7 , 𝑥8 , 𝑥9 , 𝑥10 ] and 𝑏 =


4𝑙
[𝑃1 , 𝑃2 , 𝑃3 , 𝑃4 , 𝑃5 , 𝑃6 , 𝑃7 , 𝑃8 , 𝑃9 , 𝑃10 ] where l is defined as length, E is young’s modulus and A as the
𝐸
cross-sectional area of the member. 𝐴𝑖=1𝑖𝑛2,𝑖=1,2,…,5; 𝐴𝑖=2𝑖𝑛2,𝑖=6,7,…,11; 𝐸=30𝑥106 𝑝𝑠𝑖; 𝑙=30 𝑖𝑛;
𝑃𝑖=−1000 𝑙𝑏,𝑖=2,4,6,8,10; 𝑃𝑖=0,𝑖=1,3,5,7,9;
Results and Discussion

To solve the problem, we must first determine the Diagonally dominant values and arrange it in
a diagonal form throughout the matrix. After determining the diagonal dominance, we must remove it
according to its place. We then will have 2 matrices that should look like this:

[D]^-1=
0.125 0 0 0 0 0 0 0 0 0
0 0.083333333 0 0 0 0 0 0 0 0
0 0 0.083333333 0 0 0 0 0 0 0
0 0 0 0.083333333 0 0 0 0 0 0
0 0 0 0 0.125 0 0 0 0 0
0 0 0 0 0 0.083333333 0 0 0 0
0 0 0 0 0 0 0.083333333 0 0 0
0 0 0 0 0 0 0 0.083333333 0 0
0 0 0 0 0 0 0 0 0.083333333 0
0 0 0 0 0 0 0 0 0 0.083333333

[N]=
0 0 -4 0 0 0 -2 3.464101615 0 0
0 0 0 0 0 0 3.464101615 -6 0 0
-4 0 0 0 -4 0 -2 -3.464101615 -2 3.464101615
0 0 0 0 0 0 -3.464101615 -6 3.464101615 -6
0 0 -4 0 0 0 0 0 -2 -3.464101615
0 0 0 0 0 0 0 0 -3.464101615 -6
-2 3.464101615 -2 -3.464101615 0 0 0 0 -4 0
3.464101615 -6 -3.464101615 -6 0 0 0 0 0 0
0 0 -2 3.464101615 -2 -3.464101615 -4 0 0 0
0 0 3.464101615 -3.464101615 -3.464101615 -6 0 0 0 0

b= X=
0 x1
-0.004 x2
0 x3
-0.004 x4
0 x5
-0.004 x6
0 x7
x8
-0.004
x9
0
x10
-0.004

D^-1 is the inverse diagonal matrix of D. this is obtained by multiplying the variable by 1^-1
which makes the variable 1/D. basically, what we did in the matrices is that we remove the D diagonal
from the main matrix. After determining these matrices, we will now follow the formula 𝑥𝑛𝑒𝑤 =
𝐷 −1 (𝑏 − 𝑁𝑥𝑜𝑙𝑑). I did this using the excel file for a faster solving. I have used the formula in excel
=MMULT($A$3:$J$12,$L$3:$L$12-MMULT($N$3:$W$12,E15:E24)) where $A$3:$J$12 is the D inverse
matrix, ,$L$3:$L$12 is the b matrix – the product of the matrices $N$3:$W$12, N, and E15:E24, which is
the xold.

After that we will drag the formula to the appropriate iterations to find the answer to the
problem. There is a problem in the stopping condition, which I will discuss later. In this problem, I will
base my answer on the np.linalg.solve function of the python as a checker in my code and solutions.
x1 0.01 0.003169873 0.002480877 0.002401924
x2 0.01 0.001779915 0.002575499 0.001415124
x3 0.01 0.01 0.007832265 0.006303205
x4 0.01 0.009666667 0.008276709 0.007145263
x5 0.01 0.011830127 0.009937393 0.00815689
x6 0.01 0.007553418 0.005367877 0.004563472
x7 0.01 0.006666667 0.00669391 0.005114833
x8 0.01 0.009666667 0.007361645 0.006637583
x9 0.01 0.006666667 0.005250534 0.004353205
x10 0.01 0.007553418 0.006762214 0.005347583

98 99 100
0.001367774 0.001434106 0.001368955
-0.002010527 -0.002041689 -0.002011086
-9.07473E-05 -0.000168042 -9.21139E-05
-0.003189903 -0.003189909 -0.003189913
-0.000915792 -0.000849464 -0.000914618
-0.001292974 -0.001261817 -0.001292424
7.03718E-06 1.59162E-06 6.94324E-06
-0.003412648 -0.003354587 -0.003411633
0.000387631 0.000382185 0.000387538
-0.002080766 -0.002138836 -0.002081799

Problems Encountered

Finding the stopping condition TOL in python is a problem that I have not found the solution,
since the answer to the problem if I consider the tor only result to 1 iteration with no significant answer.
And since I am expecting results similar to assignment 2, I tried to find another way to obtain the
answer.

References

https://www.youtube.com/watch?v=U4eCIIPQMAU&t=354s

https://www.youtube.com/watch?v=bR2SEe8W3Ig&t=1s

https://www.codesansar.com/numerical-methods/python-program-jacobi-iteration-method.htm

Appendix
Finals(Jacobi)_Cruz_
FrancisPaulo_M_MECP1 code.txt

You might also like