欧拉公式

import matplotlib.pyplot as plt
x = [0]
y = [1]
h = 0.1
currentx = 0
currenty = 1
for i in range(0,101):
    thisx = currentx + h
    thisy = currenty + h * (currenty - 2 * currentx / currenty) 
    x.append(thisx)
    y.append(thisy)
    currentx = thisx
    currenty = thisy
plt.plot(x,y)
结果