Difference between revisions of "Andika Ramadhan Gurnida"

From ccitonlinewiki
Jump to: navigation, search
Line 36: Line 36:
 
from math import *
 
from math import *
  
g = 9.81
+
g = 9.81
m1 = eval(input("mass 1: "))
+
m1 = eval(input("mass 1: "))
m2 = eval(input("mass 2: "))
+
m2 = eval(input("mass 2: "))
m3 = eval(input("mass 3: "))
+
m3 = eval(input("mass 3: "))
alpha = eval(input("alpha: "))
+
alpha = eval(input("alpha: "))
u = eval(input("friction coefficient: "))
+
u = eval(input("friction coefficient: "))
x = sin(alpha)
+
x = sin(alpha)
y = cos(alpha)
+
y = cos(alpha)
  
t1 = m1*g*(x-(u*y))
+
t1 = m1*g*(x-(u*y))
t2 = (m2*g*(x-(u*y))) + t1
+
t2 = (m2*g*(x-(u*y))) + t1
t3 = (m3*g*(x-(u*y))) + t2
+
t3 = (m3*g*(x-(u*y))) + t2
t4 = t3
+
t4 = t3
#Hasil
+
#Hasil
print("t1:  ",t1)
+
print("t1:  ",t1)
print("t2:  ",t2)
+
print("t2:  ",t2)
print("t3:  ",t3)
+
print("t3:  ",t3)
print("t4: ",t4)
+
print("t4: ",t4)
  
print("time to reach top speed : ",t)
+
print("time to reach top speed : ",t)
  
 
[['''No.2''']]
 
[['''No.2''']]
from math import *
+
from math import *
from sympy import *
+
from sympy import *
  
g = 9.81
+
g = 9.81
pro = 1.2
+
pro = 1.2
  
cd = eval(input("drag coefficient: "))
+
cd = eval(input("drag coefficient: "))
area = eval(input("area : "))
+
area = eval(input("area : "))
v0 = 0
+
v0 = 0
m = eval(input("car mass: "))
+
m = eval(input("car mass: "))
u = eval(input("friction: "))
+
u = eval(input("friction: "))
a = eval(input("acceleration: "))
+
a = eval(input("acceleration: "))
vt = eval(input("top speed: "))
+
vt = eval(input("top speed: "))
fs = g*u
+
fs = g*u
fdrag= (cd*area*pro*v0**2)/2*m
+
fdrag= (cd*area*pro*v0**2)/2*m
f1 = a
+
f1 = a
atot = f1 - (fdrag + fs)
+
atot = f1 - (fdrag + fs)
t = (vt-v0)/atot
+
t = (vt-v0)/atot
  
print("time to reach top speed : ",t)
+
print("time to reach top speed : ",t)

Revision as of 17:57, 23 October 2019

QUIZ 2

  1. ProbSet 2.1 no.6
  2. jawaban

from numpy import linalg import numpy as np

  1. Definisi

row1 = [0,0,2,1,2] row2 = [0,1,0,2,-1] row3 = [1,2,0,-2,0] row4 = [0,0,0,-1,1] row5 = [0,1,-1,1,-1] nmat = np.array([row1,row2,row3,row4,row5]) print("n matrix are:") print(nmat) cons = np.array([1,1,-4,-2,-1]) print("Y matrix are:") print(cons)

  1. Penyelesaian

Ans = linalg.solve(nmat,cons) x1val=int(Ans[0]) x2val=int(Ans[1]) x3val=int(Ans[2]) x4val=int(Ans[3]) x5val=int(Ans[4]) print("x result are:") print("x1=",x1val) print("x2=",x2val) print("x3=",x3val) print("x4=",x4val) print("x5=",x5val)


Ujian Tengah Semester

'''No.1''' from math import *

g = 9.81
m1 = eval(input("mass 1: "))
m2 = eval(input("mass 2: "))
m3 = eval(input("mass 3: "))
alpha = eval(input("alpha: "))
u = eval(input("friction coefficient: "))
x = sin(alpha)
y = cos(alpha)
t1 = m1*g*(x-(u*y))
t2 = (m2*g*(x-(u*y))) + t1
t3 = (m3*g*(x-(u*y))) + t2
t4 = t3
#Hasil
print("t1:  ",t1)
print("t2:  ",t2)
print("t3:  ",t3)
print("t4: ",t4)
print("time to reach top speed : ",t)

'''No.2'''

from math import *
from sympy import *
g = 9.81
pro = 1.2
cd = eval(input("drag coefficient: "))
area = eval(input("area : "))
v0 = 0
m = eval(input("car mass: "))
u = eval(input("friction: "))
a = eval(input("acceleration: "))
vt = eval(input("top speed: "))
fs = g*u
fdrag= (cd*area*pro*v0**2)/2*m
f1 = a
atot = f1 - (fdrag + fs)
t = (vt-v0)/atot
print("time to reach top speed : ",t)