SDE simulation using DifferentialEquations.jl SDE solver RKMilGeneral

I am simulating an SDE and using scatter! to plot the results.

I set

dt = 0.1 with timespan 0.0 to 1.0,

then if use EM() as the SDE solver method I get 10 equally spaced (in-time) scatter points on the plot.

However, if I use RKMilGeneral for the same purposes I end up with anywhere from 12-19 points plotted, that is 11 to 18 unevenly spaced segments, on the resultant plot.

I am curious as to why this is.

With adaptive time stepping, dt is just the initial dt.

https://diffeq.sciml.ai/stable/basics/common_solver_opts/#Basic-Stepsize-Control

  • dt: Sets the initial stepsize. This is also the stepsize for fixed timestep methods. Defaults to an automatic choice if the method is adaptive.

Ah okay, under RKMilGeneral it doesn’t say adaptive but I should be familiar enough to know that is the case, is there anyway I can force this to have fixed time-step? I suppose if I need fixed I should be sticking with another method.

Any method is adaptive by default. The documentation mentions it the other way around: there’s an explicit mention to any method that is fixed time step only.

  • EM- The Euler-Maruyama method. Strong Order 0.5 in the Ito sense. Has an optional argument split=true for controlling step splitting. When splitting is enabled, the stability with large diffusion eigenvalues is improved. Can handle all forms of noise, including non-diagonal, scalar, and colored noise. Fixed time step only.†

https://diffeq.sciml.ai/stable/basics/common_solver_opts/#Basic-Stepsize-Control

  • adaptive: Turns on adaptive timestepping for appropriate methods. Default is true.

So just use adaptive = false.

1 Like