我有一个由两个微分方程组成的系统:
dri/dt=tan(al)
dal/dt=(vz-C_alz)/C_aln
vz
的表达式一样,只依赖于l
,C_alz
和C_aln
是变量ri
和{{1}的两个表达式(这些数学表达式显示在下面的代码中)。现在我想在python中使用Odeint来解决这两个具有两个已知初始值al
的微分方程,并在ri(0)=2.5, al(0)=0.1
范围内得到ri(l)
和al(l)
[0,36] ,100]`
l
我的问题是:
只能计算from sympy import sqrt, sin, cos, tan, atan
import matplotlib.pyplot as pl
import numpy as np
from scipy.integrate import odeint
def func(w,l):
ri, al = w
C_aln= 0.0240566430653894*ri*sin(al + 11) - 3.8*sqrt((-sin(al + 11) + 1)/(1 + 3.8*sqrt(2)/ri))*(-ri**2/2401 + 1)*cos(al + 11)/(-sin(al + 11) + 1)
C_alz= -484*ri**2/1097257 + (-0.00633069554352353*ri*sqrt((-sin(al + 11) + 1)/(1 + 3.8*sqrt(2)/ri)) - 0.0240566430653894*cos(al + 11) + 14.44*sqrt(2)*sqrt((-sin(al + 11) + 1)/(1 + 3.8*sqrt(2)/ri))*(-ri**2/2401 + 1)/(ri**2*(1 + 3.8*sqrt(2)/ri)))*tan(al) + 1
vz=(-0.00420681454754192*l**2 + 0.180893025544303*l - 0.960117265980565)*(-0.00633069554352353*sqrt((sin(atan(0.00420681454754192*l**2 - 0.180893025544303*l + 0.960117265980565) - 11) + 1)/(1 + 3.8*sqrt(2)/(-0.00140227151584731*l**3 + 0.0904465127721514*l**2 - 0.960117265980565*l + 5.26992086596417)))*(-0.00140227151584731*l**3 + 0.0904465127721514*l**2 - 0.960117265980565*l + 5.26992086596417) + 14.44*sqrt(2)*sqrt((sin(atan(0.00420681454754192*l**2 - 0.180893025544303*l + 0.960117265980565) - 11) + 1)/(1 + 3.8*sqrt(2)/(-0.00140227151584731*l**3 + 0.0904465127721514*l**2 - 0.960117265980565*l + 5.26992086596417)))*(-(-0.00140227151584731*l**3 + 0.0904465127721514*l**2 - 0.960117265980565*l + 5.26992086596417)**2/2401 + 1)/((1 + 3.8*sqrt(2)/(-0.00140227151584731*l**3 + 0.0904465127721514*l**2 - 0.960117265980565*l + 5.26992086596417))*(-0.00140227151584731*l**3 + 0.0904465127721514*l**2 - 0.960117265980565*l + 5.26992086596417)**2) - 0.0240566430653894*cos(atan(0.00420681454754192*l**2 - 0.180893025544303*l + 0.960117265980565) - 11)) - 484*(-0.00140227151584731*l**3 + 0.0904465127721514*l**2 - 0.960117265980565*l + 5.26992086596417)**2/1097257 + 1
f=[tan(al), (vz-C_alz)/C_aln]
return f
init = [2.5, 0.1]
l = np.linspace(0,36,100)
sol=odeint(func, init, l)
pl.figure(1)
pl.plot(l, sol[:,0], color='b')
pl.legend()
pl.show()
的前三个数值,另一个值为零。
同时收到错误消息:
ri
任何人都可以回答我的问题: