The Linear Noise Approximation
-------------------------------

For details see:
NG van Kampen (1976) The expansion of the Master equation. Advances in Chemical Physics vol. 34, p. 245-308.


IMPLEMENTATION:
---------------

LNA[s,options] where s is a vector of chemical reactions using the Cellerator arrow notation, and the options are:


General options:
----------------

initialConditions -> a list of initial conditions

rates -> a list of the numerical values of the chemical reaction rates 

timeSpan -> the length of the simulation

MaxSteps -> maximum number of steps to be used in the stochastic simulation (Default is 1000000)


Options specific to LNA:
------------------------

sizeW -> the system size parameter used in the linear noise expansion (Default is 1)

stochasticSimulation -> whether or not a stochastic simulation is run alongside the linear noise approximation (Default is False)

SteadyStateMatrix -> whether or not an analytic version of the steady-state correlation matrix is computed. Use this option with caution, it takes a very long time to compute for systems with many species or multiple equilibria (Default is False)

LimitCycle -> If the system has a two dimansional state space of independent reactants, and the steady-state is a limit cycle, this option can be set to True to calculate the fluctuations perpendicular to the limit cycle. SteadyStateMatrix and LimitCycle cannot both be true (Default is False)



THE OUTPUT IS:
--------------

1.  A list of the solutions for the deterministic system.
2a. (If LimitCycle->False) A list of the time dependent cross-correlations of the fluctuations. For example, the cross-correlation of two species X and Y is output as the function "XYn" ('n' stands for noise).
2b. (If LimitCycle->True) A list of the time-dependent interior and exterior edges of the fluctuation gully about the limit cycle.
3. (If stochasticSimulation->True) A list of the stochastic trajectories of the system simulated using Gillespie's algorithm. For example, the stochastic trajectory of a species X is output as the function "Xstoch".
4. (If SteadyStateMatrix->True) The steady-state cross-correlation matrix given symbolically.
5. (If SteadyStateMatrix->True) A list of the species corresponding to each row of the cross-correlation matrix.


Note: 
-----

The linear noise approximation is intended for systems with a single stable steady-state. The stability of the steady-state is checked numerically, and if it appears unstable, a warning is given. If you know the system has a stable equilibrium point, ignore the warning, or increase the 'timeSpan' option.

With a rotation of the coordinate frame, the approximation scheme can be adapted to systems with stable limit cycles. The option LimitCycle->True invokes this change of variables (see, for example, K. Tomita, T. Ohta, and H. Tomita (1974) Irreversible circulation and orbital revolution - Hard mode instability in far-from-equilibrium situation. Progress of Theoretical Physics vol. 52, p. 1744-1765).

For unstable systems, the variance of the fluctuations grows in time, and the ordering implied by the expansion scheme underlying the approximation method breaks down. In these systems, the approximation is only good for short times.



Feel free to use this notebook, and make whatever changes you like in the algorithm.
My e-mail address is: mscott@math.uwaterloo.ca
 