This package provides a numerical method to automatically deriving the linear noise approximation (LNA) for a given stochastic reaction network (SRN) using Catalyst.jl. SRNs have proven their flexibility beyond chemical systems and across many different fields. These include biochemistry with gene expression models, epidemiology with compartmental models, ecology with the Lotka-Volterra equations, condensed matter and semiconductor physics with diffusion processes, and even sociology. The derived expanded system can be solved using DifferentialEquations.jl.

LinearNoiseApproximation.jl can be installed using following commands inside the Julia REPL

```
using Pkg
Pkg.add("LinearNoiseApproximation")
```

It can then be used with

`using LinearNoiseApproximation`

While LNA has applications in many different fields, it was first derived as a moment-based approximation method for stochastic chemical kinetics. For brevity and historical consistency, we will therefore stick to the naming conventions from this field.

Suppose we have a reaction network, defined with Catalyst.jl

```
rn = @reaction_network TwoStage begin
@parameters v0 v1 d0 d1 Ω
@species M(t) P(t)
v0*Ω, ∅ --> M
v1, M --> M + P
d0, M --> ∅
d1, P --> ∅
end
```

Here the system size `Ω`

is integrated into the system (propensities).

With LinearNoiseApproximation.jl, you can now simply obtain the LNA system by calling

`LNAsys = LNASystem(rn)`

This system can be solved with DifferentialEquations.jl

```
@variables v0, v1, d0, d1, Ω
rates = [v0=>4.0,v1=>10.0,d0=>1.0,d1=>1.0,Ω=>5.0]
tspan = (0.0, 20.0)
u0 =[0, 0] # initial condition for M and P
prob = ODEProblem(LNAsys, u0, tspan, rates)
sol = solve(prob,Vern7(),abstol=1e-7, saveat=1.0)
```

A complete working version of this example is in the `examples`

folder.

LNA is a moment-based approximation method for stochastic chemical kinetics
[1]. A general chemical kinetics reaction can be described as follows:
given a set of chemical species

where the stoichiometric coefficients

where

is the stoichiometric matrix, and

is the rate of the

However, the law of mass action is only valid when the number of molecules is large. When the number of molecules is small, System (1) can instead be modelled by a continuous-time Markov jump process to study the probability of the system being in a particular state at a given time. The dynamics of such a system can be described by the chemical master equation (CME) [2]:

where

is the propensity function of reaction

The chemical master equation is written directly from the rate constants and
stoichiometries of all the elementary reactions of a chemical system, but
neither analytical nor numerical solutions are in general available.
Fortunately, the chemical master equation can often be simplified in a linear
noise approximation. Linear noise approximation is an expansion of the CME
taking the inverse system size

where

where

as the Jacobian matrix of the deterministic rate equations, and

In this formulation, the LNA allows for analytical solutions that are locally valid close to macroscopic trajectories (solution of the rate equations) of the system. We refer to the review paper [2] for more details on the CME and LNA.

[1] Nicolaas Godfried van Kampen. The Expansion of the Master Equation. John Wiley & Sons, Inc., 2007.

[2] David Schnoerr, Guido Sanguinetti, and Ramon Grima. Approximation and inference methods for stochastic biochemical kinetics — a tutorial review (2017). Journal of Physics A: Mathematical and Theoretical, 50(9):093001.

[3] Nicolaas Godfried van Kampen. Stochastic Processes in Physics and Chemistry, volume 1. Elsevier, 1992.