我在運行以下代碼時收到錯誤:import matplotlib.pyplot as pltimport numpy as npm = 5E5q = .03p = .38e = math.ex = 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”對象不可調用。我嘗試修改表達式等,但無濟于事。任何幫助都會很棒。
1 回答

智慧大石
TA貢獻1946條經驗 獲得超3個贊
(q / p) ( e ** ( - x * ( p + q ) ) )
您缺少一個運算符(q / p)
& ( e ** ( - x * ( p + q ) ) )
嘗試:
y = m * ( (1 - e ** ( - x * ( p + q ) )) / ((1 + (q / p) * ( e ** ( - x * ( p + q ) ) ))) )
添加回答
舉報
0/150
提交
取消