我正试图用 scipy.integrate.odeint() 来计算一些物种的衰变 . 其中一个衰减系数非常大,这似乎导致了一个问题,我不知道为什么或如何解决它 . 这是我的代码:
from scipy.integrate import odeint
import numpy as np
import matplotlib.pyplot as plt
def decay(init,t):
a,b,c,d = init
f0 = - 6*a
f1 = 3 * a - 1e12*b
f2 = 3 * a
f3 = 1e12 * b
return [f0,f1,f2,f3]
if __name__ == '__main__':
init = [1,0,0,0]
time = np.linspace(0, 1e12, 100001)
soln = odeint(decay, init ,time)
这给了我以下错误:
lsoda-- at t (=r1) and step size h (=r2), the
corrector convergence failed repeatedly
or with abs(h) = hmin ls
in above, r1 = 0.0000000000000D+00 r2 = 0.1552206225945D-09
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/scipy/integrate/odepack.p