To a physicist, stochastic resetting is of interest because even in the simplest example of a diffusive particle undergoing Brownian motion, the system reaches a non-equilibrium stationary state. From a practical perspective, the study of stochastic resetting is often motivated in the context of search processes (see Section 1 of this review article). In biology, an interesting example of stochastic resetting is given in Section 5.5 of the same review article: consider a molecular interaction where an enzyme \(E\) binds to a substrate \(S\), and when bound triggers the production of a product \(P\), say a protein, that is, the reaction scheme
\[
E+S \rightleftharpoons ES \rightarrow E + P
\]
Every time the enzyme (reversibly) unbinds and binds, production of \(P\) is reset and restarted.
In this post, I want to illustrate how easy it is to simulate stochastic processes under resetting in SciML, specifically using the DifferentialEquations and JumpProcesses packages.
The unperturbed stochastic process
Stochastic processes in SciML are defined as stochastic differential equation problems (instances of SDEProblem), if the state space is continuous, or discrete problems (instances of DiscreteProblem), if the state space is discrete. Here’s we’ll look at SDE problems.
A (one-dimensional) SDEProblem is defined by the equation
\[
du = f(u,p,t) dt + g(u,p,t) dW
\]
where \(f\) is the drift term, \(g\) the diffusion term, \(W\) the Wiener process, and \(p\) are a set of parameters. Let’s consider the simplest example of Brownian motion in one dimension:
To model stochastic resetting, we need to augment the stochastic differential equation with a discrete jump process, that is, create a jump-diffusion problem. As explained in the JumpProcesses documentation, we need two functions: a rate function which determines the distribution of waiting times between jumps (resetting events) and a function that determines what happens to the state of the system at the time of a jump. Let’s model resetting with a constant rate, that is, Poissonian resetting, and resetting the process to its initial position:
r =2.0reset_rate(u, p, t) = rfunctionaffect!(integrator) integrator.u = u0 # reset to the starting positionnothingend
JumpProblem with problem SDEProblem with aggregator Direct
Number of jumps with discrete aggregation: 1
Number of jumps with continuous aggregation: 0
Number of mass action jumps: 0
A trajectory can be sampled and plotted using any SDE solver:
The stationary state of diffusion with Poissonian resetting
The example of simple diffusion (Brownian motion) with Poissonian (constant rate) resetting reaches a stationary state which can be computed analytically (see equation (2.18) in the review article):
\(D=\sigma^2/2\) is the diffusion constant, and \(x_r\) is the position to which the system is reset. In other words, \(p^\ast(x)\) is a Laplace distribution with mean \(x_r\) and scale parameter \(\theta=1/\alpha_0\).
We can verify that the simulation reproduces this distribution. First generate an ensemble with more trajectories:
There exist many interesting variations on the above resetting scheme. An interesting one is first-passage resetting, where the particle resets not after a certain waiting time, but whenever it crosses a threshold position \(x_0 \pm x^*\). Because resetting is now defined purely by the state of the system and not by a waiting time, it can be simulated directly using event handling functions in the DifferentialEquations package.
In particular we define a function whose zeros correspond to the event triggering, and then define a ContinuousCallback function: