【发布时间】:2018-10-20 02:44:40
【问题描述】:
我正在尝试在 python 类的方法中调用 odeint:
从 scipy.integrate 导入 odeint
类测试:
@staticmethod
def mathfunc(y, t arg1, arg2):
x , xdot = y
#some equations
return xdot, xddot
def numericalsim(self, y0, t):
y = odeint(mathfunc, y0, t, args(self.param1, self.param2))
return y
但是,我收到错误消息:未定义名称“mathfunc”。 请你帮我在课堂上调用 odeint。
【问题讨论】:
-
Python 告诉你它找不到
mathfunc而不是odeint