ode.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:accpy 作者: kramerfelix 项目源码 文件源码
def odeint(fun, t, y0, integrator=0, method=0, rtol=0, atol=1e-12):
    s = ode(fun)
    integrators = ['vode', 'zvode', 'lsoda', 'dopri5', 'dop853']
    methods = ['adams', 'bdf']
    s.set_integrator(integrators[0],
                     method=methods[0],
                     order=10,
                     rtol=rtol,
                     atol=atol,
                     with_jacobian=False)
    t0 = t[0]
    dt = t[1]-t0
    y = [y0]
    s.set_initial_value(y0, t0)
    while s.successful() and s.t < t[-1]:
        s.integrate(s.t+dt)
        y.append(s.y)
    y = array(y)
    return y
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号