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.
- Download “SimuPlant Server” from http://www.simuplant.org.
- Open the archive.
- Extract the “odesparse_1” folder. This is all we need.
- Move to the extracted “odesparse_1” folder and install the module.
python setup.py install
You will need a Fortran compiler. - 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.
- 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