Sunode — sunode documentation (original) (raw)

Solve ODEs fast and integrate them into autodiff frameworks.

Scipy has had decent solvers for ordinary differential equations for a long time, they come with some limitations however:

Sunode aims to work around those issues: We wrap the well established C library sundials to provide the solver and support for derivatives in forward and adjoint mode.

In sunode the ODE is declared with named (and possibly nested) state variables and parameters. The right-hand-side function is defined either manually using numba, or using sympy variables. In the latter case we generate python code through AST manipulation for necessary functions and compile them using numba. This allows us to solve an ode repeatetly with almost no python overhead.

The original use-case for this library was better support for solving ODEs within bayesian models in PyMC, but is useable in different contexts as well.