Skip to content

Commit 6eb9912

Browse files
committed
add fixed dt SDE simulation section
1 parent 98c3e90 commit 6eb9912

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

docs/src/model_simulation/simulation_introduction.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,17 @@ sol = solve(sprob, STrapezoid(); seed = 12345, abstol = 1e-1, reltol = 1e-1) # h
222222
plot(sol)
223223
```
224224

225+
### [SDE simulations with fixed time stepping](@id simulation_intro_SDEs_fixed_dt)
226+
StochasticDiffEq implements SDE solvers with adaptive time stepping. However, when using a non-adaptive solver (or using the `adaptive = false` argument to turn adaptive time stepping off for an adaptive solver) a fixed time step `dt` must be designated. Here we simulate the same `SDEProblem` which we struggled with previously, but using the non-adaptive [`EM`](https://en.wikipedia.org/wiki/Euler%E2%80%93Maruyama_method) solver and a fixed `dt`:
227+
```@example simulation_intro_sde
228+
sol = solve(sprob, EM(); dt = 0.001)
229+
sol = solve(sprob, EM(); dt = 0.001, seed = 1234567) # hide
230+
plot(sol)
231+
```
232+
We note that this approach also enables us to successfully simulate the SDE we previously struggled with.
233+
234+
Generally, using a smaller fixed `dt` provides a more exact simulation, but also increases simulation runtime.
235+
225236
### [Scaling the noise in the chemical Langevin equation](@id simulation_intro_SDEs_noise_saling)
226237
When using the CLE to generate SDEs from a CRN, it can sometimes be desirable to scale the magnitude of the noise. This can be done by introducing a *noise scaling term*, with each noise term generated by the CLE being multiplied with this term. A noise scaling term can be set using the `@default_noise_scaling` option:
227238
```@example simulation_intro_sde
@@ -338,9 +349,10 @@ end
338349
```
339350
This type of model will generate so called *variable rate jumps*. Simulation of such model is non-trivial (and Catalyst currently lacks a good interface for this). A detailed description of how to carry out jump simulations for models with time-dependant rates can be found [here](https://docs.sciml.ai/JumpProcesses/stable/tutorials/simple_poisson_process/#VariableRateJumps-for-processes-that-are-not-constant-between-jumps).
340351

352+
341353
---
342354
## [Citation](@id simulation_intro_citation)
343-
When you simulate Catalyst models in your research, please cite the corresponding paper(s) to support the package authors. For ODE simulations:
355+
When you simulate Catalyst models in your research, please cite the corresponding paper(s) to support the simulation package authors. For ODE simulations:
344356
```
345357
@article{DifferentialEquations.jl-2017,
346358
author = {Rackauckas, Christopher and Nie, Qing},

0 commit comments

Comments
 (0)