import matplotlib.pyplot as plt
x, y = 0, 0
tarX = 10.0
step = 0.1
X, Y = [x], [y]
def f(x:float, y:float):
return y - 2 * x / y
while x <= tarX:
a1 = f(x, y)
a2 = f(x + step, y + a1 * step)
y = y + 0.5 * (a1 + a2) * step
x = x + step
X.append(x)
Y.append(y)
plt.plot(X, Y)
plt.show()