Integrate stiff ODEs with Python

前端 未结 4 1621
深忆病人
深忆病人 2020-12-13 15:18

I\'m looking for a good library that will integrate stiff ODEs in Python. The issue is, scipy\'s odeint gives me good solutions sometimes, but the slightest change

4条回答
  •  误落风尘
    2020-12-13 15:30

    Python can call C. The industry standard is LSODE in ODEPACK. It is public-domain. You can download the C version. These solvers are extremely tricky, so it's best to use some well-tested code.

    Added: Be sure you really have a stiff system, i.e. if the rates (eigenvalues) differ by more than 2 or 3 orders of magnitude. Also, if the system is stiff, but you are only looking for a steady-state solution, these solvers give you the option of solving some of the equations algebraically. Otherwise, a good Runge-Kutta solver like DVERK will be a good, and much simpler, solution.

    Added here because it would not fit in a comment: This is from the DLSODE header doc:

    C     T     :INOUT  Value of the independent variable.  On return it
    C                   will be the current value of t (normally TOUT).
    C
    C     TOUT  :IN     Next point where output is desired (.NE. T).
    

    Also, yes Michaelis-Menten kinetics is nonlinear. The Aitken acceleration works with it, though. (If you want a short explanation, first consider the simple case of Y being a scalar. You run the system to get 3 Y(T) points. Fit an exponential curve through them (simple algebra). Then set Y to the asymptote and repeat. Now just generalize to Y being a vector. Assume the 3 points are in a plane - it's OK if they're not.) Besides, unless you have a forcing function (like a constant IV drip), the MM elimination will decay away and the system will approach linearity. Hope that helps.

提交回复
热议问题