# Code for simulating jump diffusion?

**URL:** <https://discourse.julialang.org/t/code-for-simulating-jump-diffusion/1154>\
**Category:** General Usage\
**Tags:** diffeq\
**Created:** [December 26, 2016, 5:14pm UTC](https://discourse.julialang.org/t/code-for-simulating-jump-diffusion/1154 "2016-12-26T17:14:58Z")\
**Posts on this page:** 2\
**Page:** 2

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [February 9, 2017, 11:00am UTC](https://discourse.julialang.org/t/code-for-simulating-jump-diffusion/1154/21 "2017-02-09T11:00:15Z")

</div>

This is complete. There is a new tutorial describing how to use the jumps API. The tutorial is here:

[http://docs.juliadiffeq.org/latest/tutorials/jump\_diffusion.html](http://docs.juliadiffeq.org/latest/tutorials/jump_diffusion.html)

This is part of the newest release of the JuliaDiffEq ecosystem, release notes here:

[http://juliadiffeq.org/2017/02/09/interps.html](http://juliadiffeq.org/2017/02/09/interps.html)

Note that this isn’t quite available yet, since the tag PRs have to go through for this to be released.

I want to note that I did not take the approach I discussed above for variable rate jumps. The approach that @bastikr let me to think that there was a more elegant solution, which I ended up finding in this paper:

> **[Accurate hybrid stochastic simulation of a system of coupled chemical or...](https://pubmed.ncbi.nlm.nih.gov/15740306/)**
>
> The dynamical solution of a well-mixed, nonlinear stochastic chemical kinetic system, described by the Master equation, may be exactly computed using the stochastic simulation algorithm. However, because the computational cost scales with the number...

Using an adaptation of this method (the method in this paper isn’t necessarily correct when event handling is actually done, because it will bias the Brownian path… but the way the adaptive timestepping is implemented fixes this problem), there is no loss of accuracy when applying the jumps. The extra computational cost is built into the method by using the rate equations in a new ODE/SDE (i.e. enlarging the system) using event handling. So the end result is computationally just a slightly larger SDE, which the jump API will make for you automatically, and then you just call the SDE solvers as usual. The SDE solver methods will achieve the same accuracy on the jump diffusion as it does for standard SDEs.

If you encounter any problems, just open an issue. Sorry this took longer than I thought it would.

---

<div class="post-metadata">

**Author:** ![mcreel](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mcreel/32/30088_2.png) [@mcreel](https://discourse.julialang.org/u/mcreel)\
**Post date:** [February 14, 2017, 7:15am UTC](https://discourse.julialang.org/t/code-for-simulating-jump-diffusion/1154/22 "2017-02-14T07:15:39Z")

</div>

I have had a chance to try the new code, following the tutorial. Thanks very much for this. I will report back in detail when I have had a occasion to use this for a research problem.

[Previous page](https://discourse.julialang.org/t/code-for-simulating-jump-diffusion/1154.md?page=1)
