Difference between revisions of "Algoritma UTS"
(Created page with "Algoritmanya 1. from math import * g = 9.81 m1 = int(input("Massa benda 1: ")) m2 = int(input("Massa benda 2: ")) m3 = int(input("Massa benda 3: ")) k_g1 = eval(input("Koef...") |
|||
(16 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
Algoritmanya | Algoritmanya | ||
− | 1. | + | 1. |
− | |||
from math import * | from math import * | ||
g = 9.81 | g = 9.81 | ||
+ | |||
m1 = int(input("Massa benda 1: ")) | m1 = int(input("Massa benda 1: ")) | ||
+ | |||
m2 = int(input("Massa benda 2: ")) | m2 = int(input("Massa benda 2: ")) | ||
+ | |||
m3 = int(input("Massa benda 3: ")) | m3 = int(input("Massa benda 3: ")) | ||
+ | |||
k_g1 = eval(input("Koefisien gesek1: ")) | k_g1 = eval(input("Koefisien gesek1: ")) | ||
+ | |||
k_g2 = eval(input("koefisien gesek2: ")) | k_g2 = eval(input("koefisien gesek2: ")) | ||
+ | |||
k_g3 = eval(input("Koefisien gesek3: ")) | k_g3 = eval(input("Koefisien gesek3: ")) | ||
+ | |||
kemiringan = eval(input("sudut kemiringan: ")) | kemiringan = eval(input("sudut kemiringan: ")) | ||
+ | |||
a = eval(input("percepatan: ")) | a = eval(input("percepatan: ")) | ||
+ | |||
x = sin (kemiringan) | x = sin (kemiringan) | ||
+ | |||
y = cos (kemiringan) | y = cos (kemiringan) | ||
+ | |||
t1 = m1*g*(x-k_g1*y) - m1*a | t1 = m1*g*(x-k_g1*y) - m1*a | ||
+ | |||
t2 = m2*g*(x-k_g2*y) + t1 - m2*a | t2 = m2*g*(x-k_g2*y) + t1 - m2*a | ||
+ | |||
t3 = m3*g*(x-k_g3*y) + t2 - m3*a | t3 = m3*g*(x-k_g3*y) + t2 - m3*a | ||
+ | |||
print("tegangan total: ",t3) | print("tegangan total: ",t3) | ||
− | [[File: | + | [[File:N1UTS.png]] |
+ | |||
+ | 2. | ||
+ | from math import * | ||
+ | |||
+ | from sympy import * | ||
+ | |||
+ | g = 9.81 | ||
+ | |||
+ | p = 1.2 | ||
+ | |||
+ | cd = eval(input("drag coefficient: ")) | ||
+ | |||
+ | area = eval(input("luas area: ")) | ||
+ | |||
+ | vt = eval(input("kecepatan akhir: ")) | ||
+ | |||
+ | m = eval(input("massa mobil(kg): ")) | ||
+ | |||
+ | k_g = eval(input("koef gesek: ")) | ||
+ | |||
+ | a = eval(input("percepatan: ")) | ||
+ | |||
+ | fg = g*k_g | ||
+ | |||
+ | fmobil = a | ||
+ | |||
+ | for vo in range (0,vt): | ||
+ | |||
+ | fdrg = (cd*area*p*vo**2)/2 | ||
+ | |||
+ | atot = (fmobil - (fdrg+fg)) | ||
+ | |||
+ | t1 = - vt/atot | ||
+ | |||
+ | #semua dibagi m | ||
+ | |||
+ | print("percepatan total: ", atot) | ||
+ | |||
+ | print("waktu mencapai top speed: ", t1) | ||
+ | |||
+ | [[File:N2UTS.png]] |
Latest revision as of 06:36, 29 October 2019
Algoritmanya
1. from math import * g = 9.81
m1 = int(input("Massa benda 1: "))
m2 = int(input("Massa benda 2: "))
m3 = int(input("Massa benda 3: "))
k_g1 = eval(input("Koefisien gesek1: "))
k_g2 = eval(input("koefisien gesek2: "))
k_g3 = eval(input("Koefisien gesek3: "))
kemiringan = eval(input("sudut kemiringan: "))
a = eval(input("percepatan: "))
x = sin (kemiringan)
y = cos (kemiringan)
t1 = m1*g*(x-k_g1*y) - m1*a
t2 = m2*g*(x-k_g2*y) + t1 - m2*a
t3 = m3*g*(x-k_g3*y) + t2 - m3*a
print("tegangan total: ",t3)
2. from math import *
from sympy import *
g = 9.81
p = 1.2
cd = eval(input("drag coefficient: "))
area = eval(input("luas area: "))
vt = eval(input("kecepatan akhir: "))
m = eval(input("massa mobil(kg): "))
k_g = eval(input("koef gesek: "))
a = eval(input("percepatan: "))
fg = g*k_g
fmobil = a
for vo in range (0,vt):
fdrg = (cd*area*p*vo**2)/2
atot = (fmobil - (fdrg+fg))
t1 = - vt/atot
- semua dibagi m
print("percepatan total: ", atot)
print("waktu mencapai top speed: ", t1)