Integration of ODE systems with sparse Jacobians in Python

The Centre for Plant Integrative Biology (CPIB, University of Nottingham) has developed a Python module based on the Fortran library ODEPACK to integrate ODE systems with sparse Jacobian matrices. It is quite similar in usage to the odeint function from Scipy.

  1. Download “SimuPlant Server” from http://www.simuplant.org.
  2. Open the archive.
  3. Extract the “odesparse_1” folder. This is all we need.
  4. Move to the extracted “odesparse_1” folder and install the module.
     python setup.py install
    You will need a Fortran compiler.
  5. You can then import the “odesparse” module in Python. To integrate ODEs, use the “odesparse.odeints” function. You can refer to the “README” file in the “odesparse_1” folder for the exact usage, which slightly differs from “odeint” in Scipy.
  6. One important feature of odeints is that it takes the keyword argument “JPat”, which enables you to provide the structure (matrix of 0s and 1s) of the Jacobian matrix, as a Scipy sparse matrix (e.g.: lilmatrix or csr).

Banner photo by Pai Shih

Share