Tugas Baru
Revision as of 15:03, 6 November 2019 by Dimazadhitya98 (talk | contribs) (Created page with "from math import * m = eval(input("Massa bomb : ")) g = 9.81 cd = eval(input("koef gesek udara: ")) v0 = 0 t0 = 0 dt = 1 w = g fd = cd/m error = 100 hat = [] def dv...")
from math import *
m = eval(input("Massa bomb : "))
g = 9.81
cd = eval(input("koef gesek udara: "))
v0 = 0
t0 = 0
dt = 1
w = g
fd = cd/m
error = 100
hat = []
def dvdt(w,fd):
return w-(fd*(v0)**(1.5))
while error > 0.005:
k1 = dvdt(t0, v0)
k2 = dvdt(t0 + 0.5*dt, v0 + 0.5 * dt *k1)
k3 = dvdt(t0 + 0.5*dt, v0 + 0.5 * dt *k2)
k4 = dvdt(t0 + dt, v0 + dt * k3)
v1 = v0 +(1.0/6.0)*(k1 + k2 * 2 + k3*2 + k4)
t0 = t0 + dt
error = ((v1-v0)/v1)*100
v0 = v1
hat.append(v1)
waktu = len(hat)
print ("tmaks: ", waktu +1)
print("Vt: ", v1)
credits : Eric Delbert