= Solution
For the <Gillespie algorithm>, start from $t=0$ and an integer <molecular copy number> $x\ge0$. At each step use the current state, without the mean approximation in parts (a)–(b). The <reaction propensity functions> are $a_+(x)=\lambda$ and $a_-(x)=\beta\sqrt x$, and their sum is $a_0(x)=\lambda+\beta\sqrt x$. Draw two independent <uniform random variables> $U_1,U_2$ on $(0,1)$ and set
$$
\Delta t=-\frac{\log U_1}{a_0(x)}.
$$
The waiting time has an <exponential distribution> with rate $a_0(x)$. Keep the sample path constant on $[t,t+\Delta t)$, advance $t\leftarrow t+\Delta t$, and choose the reaction by
$$
\boxed{x\leftarrow\begin{cases}
x+3,&U_2<\lambda/a_0(x),\\
x-1,&U_2\ge\lambda/a_0(x).
\end{cases}}
$$
Record the post-jump state, recompute both <reaction propensity functions>, and repeat with fresh independent uniforms. At $x=0$ the death propensity is zero, so only a birth is selected and the trajectory remains nonnegative. For a prescribed terminal time $T$, if the next event would occur after $T$, keep the current state to $T$ and stop. This produces exact piecewise constant sample paths of the specified <continuous-time Markov chain>.
Back to article page