Integrate stiff ODEs with Python

前端 未结 4 1575
深忆病人
深忆病人 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:38

    If you can solve your problem with Matlab's ode15s, you should be able to solve it with the vode solver of scipy. To simulate ode15s, I use the following settings:

    ode15s = scipy.integrate.ode(f)
    ode15s.set_integrator('vode', method='bdf', order=15, nsteps=3000)
    ode15s.set_initial_value(u0, t0)
    

    and then you can happily solve your problem with ode15s.integrate(t_final). It should work pretty well on a stiff problem.

    (See also http://www.scipy.org/NumPy_for_Matlab_Users)

提交回复
热议问题