使用Python解决耦合延迟微分方程(DDEs)的问题

时间:2013-09-30 21:23:47

标签: python numpy scipy

我正在尝试使用pydelay库来解决延迟微分方程组。我已按照instructions设置我的模型。但是,我遇到了一些错误,非常感谢任何建议。

这是我的代码:

import numpy as np
import pylab as pl
from pydelay import dde23

# define the equations
eqns = { 
    'B' : 'L*((D*D/(D*D+b*b))*(H/(H+v)))- w*B',
    'H' : 'w*B(t-tau) - H*(a_min + a_max*(b*b/(b*b+D*D))-s*(F/(F-H)))',
    'F' : 'H*(a_min + a_max*(b*b/(b*b+D*D))-s*(F/(F-H))) - m*F',
    'D' : 'c*F - r_a*(F+H) - r_b*B'
    }

#define the parameters
params = {
    'L' : 2000.0,       # laying rate
    'b' : 500,  # 
    'w' : 1.0/9,  # pupation rate of brood
    'tau' : 12.0, # time lag
    'a_min' : 0.25,  # 
    'a_max' : 0.25,
    's' : 0.75,
    'm' : 0.3,
    'c' : 0.10,
    'r_a' : 0.007,
    'r_b' : 0.018,
    'v' : 5000.0
    }

# Initialise the solver
dde = dde23(eqns=eqns, params=params)

# set the simulation parameters 
dde.set_sim_params(tfinal=50, dtmax=1.0)

# set the history
n=12
t_hist = np.linspace(0, n, n)
B_hist = np.array([5] * n)
H_hist = np.array([20] * n)
F_hist = np.array([10] * n)
D_hist = np.array([100] * n)

histdic = {
    't': t_hist,
    'B': B_hist,
    'H': H_hist,
    'F': F_hist,
    'D': D_hist,
}
dde.hist_from_arrays(histdic)

# run the simulator
dde.run()

我遇到的错误是:

Number of Minimum steps taken: 23090
Error: Scipy could not calculate spline for variable H.
Error: Scipy could not calculate spline for variable B.
Error: Scipy could not calculate spline for variable D.
Error: Scipy could not calculate spline for variable F.

0 个答案:

没有答案