Difference between revisions of "Soal A"
Dikaauliady (talk | contribs) |
Dikaauliady (talk | contribs) |
||
(3 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | Video Penjelasan : https://youtu.be/KyyqYn2C-JY | ||
+ | |||
import numpy as np | import numpy as np | ||
+ | import math | ||
+ | |||
+ | #1. input massa | ||
+ | m1 = eval(input('massa kotak 1 adalah ')) | ||
+ | |||
+ | m2 = eval(input('massa kotak 2 adalah ')) | ||
+ | |||
+ | m3 = eval(input('massa kotak 3 adalah ')) | ||
+ | |||
+ | m4 = eval(input('massa kotak 4 adalah ')) | ||
+ | |||
+ | |||
+ | #2. input nilai percepatan dan sudut | ||
+ | a = eval(input('percepatan sebesar ')) | ||
+ | |||
+ | alfa = eval(input('besar sudutnya adalah ')) | ||
+ | sinteta = round( math.sin(math.radians(alfa)),2) | ||
− | a | + | g = 9.8 |
+ | |||
+ | #2. definisi matriks | ||
+ | x1 = x2 = x3 = (g*sinteta) - a | ||
− | + | x4 = g + a | |
+ | |||
+ | A = np.array ([[m1,0,0,0], [m1,m2,0,0], [m1,m2,m3,0], [0,0,0,m4]], float) | ||
+ | x = np.array ([x1,x2,x3,x4], float) | ||
− | + | n = len(A) | |
− | + | print ('matriks A :', '\n', A) | |
+ | print ('matriks x :', '\n',x) | ||
− | + | #3. Nilai Tegangan | |
+ | T=np.dot(A,x) | ||
+ | print ('matrix T', T) |
Latest revision as of 22:23, 28 October 2019
Video Penjelasan : https://youtu.be/KyyqYn2C-JY
import numpy as np import math
- 1. input massa
m1 = eval(input('massa kotak 1 adalah '))
m2 = eval(input('massa kotak 2 adalah '))
m3 = eval(input('massa kotak 3 adalah '))
m4 = eval(input('massa kotak 4 adalah '))
- 2. input nilai percepatan dan sudut
a = eval(input('percepatan sebesar '))
alfa = eval(input('besar sudutnya adalah ')) sinteta = round( math.sin(math.radians(alfa)),2)
g = 9.8
- 2. definisi matriks
x1 = x2 = x3 = (g*sinteta) - a
x4 = g + a
A = np.array ([[m1,0,0,0], [m1,m2,0,0], [m1,m2,m3,0], [0,0,0,m4]], float) x = np.array ([x1,x2,x3,x4], float)
n = len(A)
print ('matriks A :', '\n', A) print ('matriks x :', '\n',x)
- 3. Nilai Tegangan
T=np.dot(A,x) print ('matrix T', T)