Difference between revisions of "UTS Senno"
Ahmadsennop (talk | contribs) (Created page with "Soal A Soal B import numpy as np a = 5 b = 1 c = 2 def diff_v (t,v): fungsi = a - b -c return (fungsi) v = 0 h = 1 step_size = np.arange (0,20,h) for t in step...") |
Ahmadsennop (talk | contribs) |
||
Line 28: | Line 28: | ||
print ('maka v setelah 20 detik adalah', v) | print ('maka v setelah 20 detik adalah', v) | ||
+ | |||
+ | |||
+ | |||
+ | [[ File:Hasil uts soal b senno.PNG ]] |
Revision as of 15:12, 21 October 2019
Soal A
Soal B
import numpy as np a = 5 b = 1 c = 2
def diff_v (t,v):
fungsi = a - b -c return (fungsi)
v = 0 h = 1 step_size = np.arange (0,20,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 20 detik adalah', v)