【发布时间】:2020-07-20 05:06:20
【问题描述】:
鉴于此梁偏转方程,我被要求绘制它,但我不断收到此错误消息:
这是我的代码:
import math
import matplotlib.pyplot as plt
import scipy.constants
import numpy as np
p_l = 2.5
E = 50000
I = 30000
L = 600
fsy = 6
fsx = scipy.constants.golden
dx = 0.01
x_max = 100
x = np.arange(0.0, x_max + dx, dx)
v_x = ((p_l)/(E*I*L))*((-x**5)+(2(600**2)*(x**3))-(600**4)*x)
fig = plt.figure(figsize = (fsx, fsy))
plt.plot(x, v_x, color = 'k', linestyle = '-', linewidth = 2.0, marker = '.')
plt.title("Plot of v(x)", fontsize=15)
plt.xlabel(" ($s$)")
plt.ylabel("$y$ ($m$)")
plt.ylim(-105, 105)
plt.legend()
plt.show()
这是我不断收到的错误消息:
TypeError Traceback (most recent call last)
<ipython-input-37-4d6b17714a72> in <module>
18 x = np.arange(0.0, x_max + dx, dx)
19
---> 20 v = ((p_l)/(E*I*L))*((-x**5)+(2(600**2)*(x**3))-(600**4)*x)
21
22 fig = plt.figure(figsize = (fsx, fsy))
TypeError: 'int' object is not callable
如果可以的话请帮忙!非常感谢
【问题讨论】:
-
检查括号 -
2(600**2)无效。你可能想要2 * (600 ** 2)。 -
看看这里 [w3schools.com/python/]