Algoritma UTS

From ccitonlinewiki
Jump to: navigation, search

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)

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

  1. semua dibagi m

print("percepatan total: ", atot)

print("waktu mencapai top speed: ", t1)

N2UTS.png