Pass args for solve_ivp (new SciPy ODE API)

后端 未结 6 1558
野性不改
野性不改 2020-12-15 20:08

For solving simple ODEs using SciPy, I used to use the odeint function, with form:

scipy.integrate.odeint(func, y0, t, args=(), Dfun=None, col_deriv=0, full_         


        
6条回答
  •  轮回少年
    2020-12-15 20:27

    For completeness, I think you can also do this but I'm not sure why you would bother since the other two options posted here are perfectly fine.

    from functools import partial
    fun = partial(dy_dt, arg1=arg1, arg2=arg2)
    scipy.integrate.solve_ivp(fun, t_span, y0, method='RK45', t_eval=None, dense_output=False, events=None, vectorized=False, **options)
    

提交回复
热议问题