Pass args for solve_ivp (new SciPy ODE API)

It doesn't seem like the new function has an args parameter. As a workaround you can create a wrapper like

def wrapper(t, y):
    orig_func(t,y,hardcoded_args)

and pass that in.


Relatively recently there appeared a similar question on scipy's github. Their solution is to use lambda:

solve_ivp(fun=lambda t, y: fun(t, y, *args), ...)

And they argue that there is already enough overhead for this not to matter.


Recently the 'args' option was added to solve_ivp, see here: https://github.com/scipy/scipy/issues/8352#issuecomment-535689344