import numpy as np
import matplotlib.pyplot as plt
x = 0
y = 1
t = 0.1
list_1=[]
list_2=[]
for i in range(100):
y = 1.1*y - (0.2*x)/y
x = x + t
print(x,y)
line1 = x #line为每一次获取的数据
line2 = y
list_1.append(line1) #将每一次获取到的数据存放到总的列表中
list_2.append(line2)
fig1=plt.figure()#创建一个绘图对象
plt.title("Euler") #图像标题
plt.plot(list_1, list_2, color='green')
plt.plot(x,y)
plt.show()
0.1 1.1
0.2 1.191818181818182
0.30000000000000004 1.277437833714722
0.4 1.35821259956029
0.5 1.4351329186577972
0.6 1.5089662535663324
0.7 1.580338237655218
0.7999999999999999 1.6497834310477122
0.8999999999999999 1.717779347860088
0.9999999999999999 1.7847708324979834