我在运行以下代码时收到错误:
import matplotlib.pyplot as plt
import numpy as np
m = 5E5
q = .03
p = .38
e = math.e
x = np.array (range(5))
#factor = e ** ( - x ( p + q ) )
#top = (1 - e ** ( - x ( p + q ) ))
#bottom = (1 + (q / p) ( e ** ( - x ( p + q ) ) ))
y = m * ( (1 - e ** ( - x * ( p + q ) )) / ((1 + (q / p) ( e ** ( - x * ( p + q ) ) ))) )
plt.plot(x,y,label='y = x**2')
plt.title("Testing")
plt.xlabel("x axis")
plt.ylabel("y axis")
plt.grid(alpha = .4,linestyle='--')
plt.plot(x,y,label='y=x**2')
plt.legend()
plt.show()
我不明白错误TypeError:当我运行代码时,“float”对象不可调用。我尝试修改表达式等,但无济于事。任何帮助都会很棒。
智慧大石
相关分类