Direct solution of the Chemical Master Equation in Julia.
Author voduchuy
8 Stars
Updated Last
6 Months Ago
Started In
February 2022


An extensible toolkit for direct numerical solution of the Chemical Master Equation based on the Finite State Projection and related algorithms.


This package aims to offer dynamic, fast, and customizable methods for direct numerical integration of the Chemical Master Equation (CME) in Julia. Currently, it has:

  • Transient solution of the CME for time-homogeneous reaction rates/propensities as well as time-varying reaction rates/propensities using Finite State Projection and related variants.
  • Dynamic state spaces: The truncated state space is adapted on-the-fly to remove redundant states with low probabilities and add more states to ensure the truncation error is within user-specified tolerance.
  • Customizable: Users can choose how the dynamic state space is managed (by specifying parameters for existing SpaceAdapter subtypes or write their own SpaceAdapter) and how the reduced ODEs are solved (by choosing one among the multitude options offered by DifferentialEquations.jl). Advanced users can write their own dynamic state space management policy by subtyping SpaceAdapter.
  • Sensitivity analysis: Compute partial derivatives of the FSP solution with respect to model parameters. Users do not need to write analytic expressions of the propensity's partial derivatives. Instead, the package applies existing tools from ModelingToolkit.jl and ForwardDiff.jl to generate those derivatives automatically.
  • Accept reaction systems defined using Catalyst.jl DSL.


This package can be installed using Julia's package management. For the last stable version from the General Registry,

import Pkg; Pkg.add("NumCME")

For the latest commit on this repository,

import Pkg; Pkg.add("")

Possible improvements