Pembahasan 3A

From ccitonlinewiki
Revision as of 00:15, 30 October 2019 by Satriayusuf (talk | contribs) (Created page with "'''Cara 1''' from numpy import linalg import numpy as np import math #penginputan data. dengan asumsi tidak ada gesekan dan sistem seimbang (percepatan=0) m1 = int(input("Ma...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Cara 1

from numpy import linalg 

import numpy as np import math

  1. penginputan data. dengan asumsi tidak ada gesekan dan sistem seimbang (percepatan=0)

m1 = int(input("Massa Benda 1 ? ")) m2 = int(input("Massa Benda 2 ? ")) m3 = int(input("Massa Benda 3 ? ")) p1 = int(input("sudut a ? ")) sina= math.sin(math.radians (p1)) print (sina) g = float(input("Gravitasi ? ")) print ("hasil sina adalah :") a= np.array ([[1,0,0] ,[1,1,0], [2,1,1]]) b= np.array ([[m1*sina*g],[(2*m1+m2)*sina*g],[((2*(2*m1+m2))+m3)*sina*g]]) c= np.array ([[1,0,0,m1*sina*g] ,[1,1,0,(2*m1+m2)*sina*g], [2,1,1,((2*(2*m1+m2))+m3)*sina*g]])

print ('persamaan matrix A adalah :') print (a) print ('persamaan matrix B adalah :') print (b) print ('persamaan matrix-nya adalah:') print (c) matx = a cons = b

  1. proses Gauss-Jordan

persamaan = linalg.solve (matx,cons) x1l = float(persamaan[0]) x2l = float(persamaan[1]) x3l = float(persamaan[2]) g= (x1l, x2l, x3l) print ("hasil X adalah :") print (g) print (" maka hasil T1, T2, T3 adalah") print (x1l) print (x2l) print (x3l) print ("hasil sina adalah :") print (sina)

File:N1a
500px
File:N1b
500px


Cara 2

import math

  1. penginputan data massa dan gravitasi

m1 = int(input("Massa Benda 1 ? ")) m2 = int(input("Massa Benda 2 ? ")) m3 = int(input("Massa Benda 3 ? ")) g = float(input("Gravitasi ? "))

  1. penghitungan sudut

p1 = int(input("sudut a ? ")) sina= math.sin(math.radians (p1)) print (sina)

  1. perhitungan Tegangan tali

T1 = m1*sina*g T2 = m2*sina*g + T1 T3 = m3*sina*g + T2 print("T1", T1) print("T2",T2) print("T3", T3) print("Sin theta = ", sina,"")

File:N1c2
500px