Python中过于生硬的颂歌

2024-10-02 20:32:10 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在研究一个过于僵硬的Michaelis-Menten类型的系统(已经在Matlab中实现并发布,用ode15s很容易解决)。我把它翻译成Python,但是没有一个解算器可以在集成的第2步之外继续。 我试过:

#time
t_start = -10
t_end = 12
t_step = 0.01

# Number of time steps: 1 extra for initial condition
num_steps = np.floor((t_end - t_start)/t_step) + 1
[...]
#integration

r = integrate.ode(JahanModel_ODE).set_integrator('lsoda', atol=1e-8,rtol=1e-6)

对于集成商:

^{pr2}$

有不同的公差。在

我得到的只是

UserWarning: lsoda: Excess work done on this call (perhaps wrong Dfun type). 'Unexpected istate=%s' % istate))

或者

UserWarning: vode: Excess work done on this call. (Perhaps wrong MF.) 'Unexpected istate=%s' % istate))

我也尝试了不同的t_step值。在

这里似乎已经有了一个令人满意的答案:Integrate stiff ODEs with Python,但是这些链接已经不起作用了,google认为lsoda已经优于LSODE。在

编辑:这里是完整的代码,没有打印实例。Gistlink


Tags: timeonstepcallstepsthisstartwork