Difference between revisions of "Soal B"

From ccitonlinewiki
Jump to: navigation, search
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
Video Penjelasan : https://youtu.be/fHKxJAJnNBE
 +
 +
 
import numpy as np
 
import numpy as np
a = 10
 
  
b = 1
+
a = 10 #asumsi percepatan mobil sebesar 10m/s2
 +
 
 +
b = 1 #asumsi perlambatan gesekan
  
c = 2
+
c = 2 #asumsi perlambatan angin
  
 
def diff_v (t,v):
 
def diff_v (t,v):
Line 23: Line 27:
 
     v = v + 1/6*(k1+2*k2+2*k3+k4)*h
 
     v = v + 1/6*(k1+2*k2+2*k3+k4)*h
  
print ('maka v setelah 10 detik adalah', v)
+
print ('maka v setelah 10 detik adalah', v) #asumsi t=10s

Latest revision as of 12:43, 28 October 2019

Video Penjelasan : https://youtu.be/fHKxJAJnNBE


import numpy as np

a = 10 #asumsi percepatan mobil sebesar 10m/s2

b = 1 #asumsi perlambatan gesekan

c = 2 #asumsi perlambatan angin

def diff_v (t,v):

   fungsi = a - b -c
   return (fungsi)

v = 0

h = 1 step_size = np.arange (0,10,h)

for t in step_size:

   k1 = diff_v (t,v)
   k2 = diff_v ((t+0.5*h), (v+0.5*k1*h))
   k3 = diff_v ((t+0.5*h), (v+0.5*k2*h))
   k4 = diff_v ((t+h), (v+k1*h))
   v = v + 1/6*(k1+2*k2+2*k3+k4)*h

print ('maka v setelah 10 detik adalah', v) #asumsi t=10s