Python 2.7 积分轨道轨迹2
最初的二阶颂歌是Python 2.7 积分轨道轨迹2,python-2.7,scipy,ipython,differential-equations,Python 2.7,Scipy,Ipython,Differential Equations,最初的二阶颂歌是 x'' - 2 * omega * y' - omega ** 2 * x = - mue * (x + pi2 * r12) / np.sqrt((x + pi2 * r12) ** 2 + y ** 2) ** 3 - mum * (x - pi1 * r12) / np.sqrt((x - pi1 * r12) ** 2 + y ** 2) y'' + 2 * omega * x' - omega **2 * y = - mue * y / np.sqrt((x + pi
x'' - 2 * omega * y' - omega ** 2 * x = - mue * (x + pi2 * r12) / np.sqrt((x + pi2 * r12) ** 2 + y ** 2) ** 3 - mum * (x - pi1 * r12) / np.sqrt((x - pi1 * r12) ** 2 + y ** 2)
y'' + 2 * omega * x' - omega **2 * y = - mue * y / np.sqrt((x + pi2 * r12) ** 2 + y ** 2) ** 3 - mum * y / np.sqrt((x - pi1 * r12) ** 2 + y ** 2)
z'' = 0
这是我用来解ODE的代码,但首先我把它分成了两个一阶
我收到错误消息,第61行的模块不可调用
第61行是u=odeint(deriv,u0,dt)
假设您的意思是这个错误:
~/coding$ python orbit1.py
Traceback (most recent call last):
File "orbit1.py", line 61, in <module>
u = odeint(deriv, u0, dt)
TypeError: 'module' object is not callable
导入整个模块并将其命名为odeint
。试一试
from scipy.integrate import odeint
相反,或者
import scipy.integrate
[...]
u = scipy.integrate.odeint(deriv, u0, dt)
应该给你什么
from scipy.integrate import odeint
import scipy.integrate
[...]
u = scipy.integrate.odeint(deriv, u0, dt)