[SciPy-Dev] Adding an argument to 'odeint' to control the order of the first two arguments of the user's function.

Warren Weckesser warren.weckesser at gmail.com
Sun Jan 21 12:36:16 EST 2018


In 'scipy.integrate', the 'ode' class and the function 'solve_ivp' assume
that first two arguments of the functions provided by the user are 't'
("time") followed by 'y' (the current state).  The older solver, 'odeint',
expects those arguments to be in the opposite order.  This is a nuisance
for anyone who wants to use the same functions with the different solvers.

To fix this, I've created a pull request in which the argument 'tfirst' is
added to 'odeint': https://github.com/scipy/scipy/pull/8318. When 'tfirst'
is True, 'odeint' uses the same convention as 'solve_ivp' and the 'ode'
class.  The change is implemented in the C code to avoid the overhead that
would result from using a function wrapper with reversed arguments.

Comments on the pull request are welcome.

Warren
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/scipy-dev/attachments/20180121/cf5aa3f2/attachment.html>


More information about the SciPy-Dev mailing list