import numpy as np
import matplotlib.pyplot as plt
x=np.zeros(100)
y=np.zeros(100)
x[0]=0
y[0]=1
y_yuan=np.zeros(100)
y_yuan[0]=1
for i in range(1,100):
k_yuan=(y[i-1]-2*x[i-1]/y[i-1])
y[i]=y[i-1]+0.1*k_yuan
x[i] = 0.1 +x[i-1]
k_xian = (y[i] - 2 * x[i] / y[i])
y[i]=y[i-1]+0.1*(0.5*(k_yuan+k_xian))
for i in range(100):
y_yuan[i]=y[i-1]+0.1*(y[i-1]-2*x[i-1]/y[i-1])
x[i] = 0.1 + x[i - 1]
plt.subplot(1,2,1)
plt.scatter(x,y)
plt.subplot(1,2,2)
plt.scatter(x,y_yuan)
plt.show()
2021-09-24
最新推荐文章于 2022-03-22 11:07:12 发布