# Documentation of ImplicitRKMil - StochasticDiffEq.jl

**URL:** <https://discourse.julialang.org/t/documentation-of-implicitrkmil-stochasticdiffeq-jl/102104>\
**Category:** Modelling & Simulations\
**Tags:** documentation, sde, algorithm, differentialequation\
**Created:** [July 26, 2023, 9:43am UTC](https://discourse.julialang.org/t/documentation-of-implicitrkmil-stochasticdiffeq-jl/102104 "2023-07-26T09:43:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![lappet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lappet/32/4566_2.png) [@lappet](https://discourse.julialang.org/u/lappet)\
**Post date:** [July 26, 2023, 9:43am UTC](https://discourse.julialang.org/t/documentation-of-implicitrkmil-stochasticdiffeq-jl/102104/1 "2023-07-26T09:43:33Z")

</div>

My goal is to undertsand the actual implementation of the `ImplicitRKMil` algorithm [here](https://docs.sciml.ai/DiffEqDocs/stable/solvers/sde_solve/#Stiff-Methods). Are there any notes or book sections directly relating to the code [here](https://github.com/SciML/StochasticDiffEq.jl/blob/4b22fcb1df183574244aaf626849f5f6e8855a99/src/perform_step/sdirk.jl)?

The perspective of my question is this: I have a bunch of stiff SDEs where `ImplicitRKMil` with `theta=1` (i.e. backward Euler) works best by far. However, it’s still not super stable, so I’m asking myself whether it would be possible to have higher-order implicit methods (in the sense that Euler is the simplest RK method)?

---

<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:** [August 8, 2023, 9:33pm UTC](https://discourse.julialang.org/t/documentation-of-implicitrkmil-stochasticdiffeq-jl/102104/2 "2023-08-08T21:33:41Z")

</div>

> [@lappet](#):
>
> My goal is to undertsand the actual implementation of the `ImplicitRKMil` algorithm [here](https://docs.sciml.ai/DiffEqDocs/stable/solvers/sde_solve/#Stiff-Methods). Are there any notes or book sections directly relating to the code [here](https://github.com/SciML/StochasticDiffEq.jl/blob/4b22fcb1df183574244aaf626849f5f6e8855a99/src/perform_step/sdirk.jl)?

[https://www.sciencedirect.com/science/article/pii/S0377042706004195](https://www.sciencedirect.com/science/article/pii/S0377042706004195) describes it.

> [@lappet](#):
>
> The perspective of my question is this: I have a bunch of stiff SDEs where `ImplicitRKMil` with `theta=1` (i.e. backward Euler) works best by far. However, it’s still not super stable, so I’m asking myself whether it would be possible to have higher-order implicit methods (in the sense that Euler is the simplest RK method)?

With theta=1 it’s not implicit Euler, it’s still an implicit Milstein method.

Going to Order 1.5 is very expensive in terms of the Levy area calculations. For details see [[1801.00784] Expansion of Iterated Stratonovich Stochastic Integrals of Arbitrary Multiplicity Based on Generalized Iterated Fourier Series Converging Pointwise](https://arxiv.org/abs/1801.00784)

---

<div class="post-metadata">

**Author:** ![lappet](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lappet/32/4566_2.png) [@lappet](https://discourse.julialang.org/u/lappet)\
**Post date:** [August 9, 2023, 7:16am UTC](https://discourse.julialang.org/t/documentation-of-implicitrkmil-stochasticdiffeq-jl/102104/3 "2023-08-09T07:16:12Z")

</div>

Thanks for your answer, Chris.

> [@ChrisRackauckas](#):
>
> [SDELab: A package for solving stochastic differential equations in MATLAB - ScienceDirect](https://www.sciencedirect.com/science/article/pii/S0377042706004195) describes it.

I will check this out - would it be welcome if I add a docstring based on this? I think it’s nice to have some maths there relating to the code.

> [@ChrisRackauckas](#):
>
> With theta=1 it’s not implicit Euler, it’s still an implicit Milstein method.

Yeah, you’re right. I have additive noise though, in which case this makes no difference, does it?

> [@ChrisRackauckas](#):
>
> Going to Order 1.5 is very expensive in terms of the Levy area calculations. For details see [[1801.00784] Expansion of Iterated Stratonovich Stochastic Integrals of Arbitrary Multiplicity Based on Generalized Iterated Fourier Series Converging Pointwise](https://arxiv.org/abs/1801.00784)

Well, it sure looks involved… Feels like this is too far out of my expertise to try something myself, unfortunately.

---

<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:** [August 9, 2023, 9:34am UTC](https://discourse.julialang.org/t/documentation-of-implicitrkmil-stochasticdiffeq-jl/102104/4 "2023-08-09T09:34:52Z")

</div>

> [@lappet](#):
>
> I will check this out - would it be welcome if I add a docstring based on this? I think it’s nice to have some maths there relating to the code.

Yes that would be fine.

> [@lappet](#):
>
> Yeah, you’re right. I have additive noise though, in which case this makes no difference, does it?

That does make a difference to an extent. SKenCarp should be better there, but yeah there aren’t that many methods focused on that domain and it would be nice to make some more.
