【发布时间】:2016-03-08 09:12:03
【问题描述】:
我对任何编码都非常陌生,并且遇到了很多 python 问题(python 3)。 我正在尝试在一篇与 HIV 相关的科学论文中重现数字。他们使用了我必须重新创建的模型的计算机模拟。我不断改变方面并不断收到不同的错误消息 - 当前的错误消息是 TypeError: odeint() missing 1 required positional argument: 't'
这是我正在使用的代码,基于我之前的作业。
#Import necessary programmes
import numpy as np
from scipy.integrate import odeint as od
import matplotlib.pyplot as plt
#define equation for uninfected vs free virus
def free_virus(x,y,v,vm):
x=x=l-(d*x)-(b*x*v)-(bm*x*vm)
v=(k*y)-(u*v)
return np.array(x,v)
l=10
d=0.01
a=0.5
u=3
b=0.01
bm=0.005
e=0.0001
k=km=10
init= [0,0]
t= np.arange(0,40,5)
figure_1=od(free_virus,t,args=(0,40))
plt.plot(figure_1,t)
x 和 v 是科学论文中给出的方程式,我需要将它们相互对照odeint code:
变量在论文中给出 如果这看起来很基本,我很抱歉,但非常感谢任何帮助。这已被编辑添加到我的代码中。
【问题讨论】:
-
我以为我已将其作为图片附加:我是新来的 - 现在已添加。谢谢。
标签: python-3.x differential-equations odeint