Difference between revisions of "Tugas Runge-Kutta"
Eric Delbert (talk | contribs) (Created page with " == Tugas Rungge-Kutta Pada Fenomena Fisika == '''CODE TUGAS''' from math import * m = eval(input("massa gerobak: ")) g = 9.81 cd = eval(input("koefisien drag udara: ")...") |
Eric Delbert (talk | contribs) (→Tugas Rungge-Kutta Pada Fenomena Fisika) |
||
Line 1: | Line 1: | ||
== Tugas Rungge-Kutta Pada Fenomena Fisika == | == Tugas Rungge-Kutta Pada Fenomena Fisika == | ||
+ | |||
+ | |||
+ | == VIDEO PEMBAHASAN == | ||
+ | |||
+ | [[File:Rusabudak.mp4]] | ||
'''CODE TUGAS''' | '''CODE TUGAS''' |
Latest revision as of 02:01, 6 November 2019
Tugas Rungge-Kutta Pada Fenomena Fisika
VIDEO PEMBAHASAN
CODE TUGAS
from math import *
m = eval(input("massa gerobak: ")) g = 9.81 cd = eval(input("koefisien drag udara: ")) u = eval(input("koefisien gesek bukit: ")) T = eval(input("Tegangan Tali: ")) theta = eval(input("kemiringan bukit: ")) suduttheta = theta * pi/180 c = sin(suduttheta) d = cos(suduttheta) v0 = 0 t0 = 0 dt = 1 error = 100 p = (T - m*g*c - m*g*d*u)/m q = cd/m
Mat = []
def dvdt(t0, v0): return p-(q*(v0)**(1.5))
while error > 0.002: 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) vmaks = v0 + (1.0 / 6.0)*(k1 + 2 * k2 + 2 * k3 + k4) t0 = t0 + dt error = ((vmaks - v0) / vmaks)*100 #persentase error v0 = vmaks Mat.append(vmaks) waktu = len(Mat)
print ("tmaks: ", waktu+1) print ("Vmaks: ", vmaks)