Difference between revisions of "Problem set 7.1 No.1"

From ccitonlinewiki
Jump to: navigation, search
(Created page with "File:Capture.PNG")
 
Line 1: Line 1:
 
[[File:Capture.PNG]]
 
[[File:Capture.PNG]]
 +
 +
import numpy as np
 +
 +
#definisi fungsi
 +
def diff_y (x,y) :
 +
    fungsi = x** - 4y
 +
    return (fungsi)
 +
 +
x = 0
 +
y = 1
 +
 +
h = 0.01
 +
step_size = np.arange (0,0.03,h)
 +
 +
for t in step_size :
 +
    k1 = diff_y (x,y)
 +
    k2 = diff_y ((x+0.5*h), (y+0.5*k1*h))
 +
 +
    y = y + k1*h
 +
 +
print ('maka y(0.03) adalah', y)

Revision as of 15:12, 14 October 2019

Capture.PNG

import numpy as np

  1. definisi fungsi

def diff_y (x,y) :

   fungsi = x** - 4y
   return (fungsi)

x = 0 y = 1

h = 0.01 step_size = np.arange (0,0.03,h)

for t in step_size :

   k1 = diff_y (x,y)
   k2 = diff_y ((x+0.5*h), (y+0.5*k1*h))
   y = y + k1*h

print ('maka y(0.03) adalah', y)