Skip to contents

RKMilGeneral() is the Runge-Kutta Milstein method of strong order 1 for any noise. For diagonal and scalar noise it uses J = dW^2 / 2 (minus dt / 2 in the Ito interpretation); for nondiagonal noise it uses the iterated integrals J = dW dW' / 2 + dt A with the Levy area A of MronRoe(), computed from the second noise process, whose increments over a step carry the coefficient_length(m, n, MronRoe()) Fourier coefficients (scaled by sqrt(dt)). With n terms given by p, or by terms_needed(m, dt, c dt^(3/2), MronRoe(), MaxL2()). After a rejected step the iterated integrals are assembled from the stored noise pieces of the step, and with a NoiseGrid() from the grid intervals inside the step when there are at least two. The error estimate is that of the Runge-Kutta Milstein method.

Usage

RKMilGeneral(
  interpretation = c("Ito", "Stratonovich"),
  ii_approx = IILevyArea(),
  c = 1,
  p = NULL,
  dt = NULL
)

Arguments

interpretation

"Ito" or "Stratonovich".

ii_approx

IILevyArea() or IICommutative(), the evaluator of the iterated integrals when the step has no coefficients.

c

The accuracy constant of the truncation, eps = c dt^(3/2).

p

The number of Fourier terms, NULL (or TRUE) to choose it.

dt

Accepted for the signature; the truncation comes from the step size of the solve.

Value

An SDE algorithm.

Examples

f <- function(u, p, t) -u
g <- function(u, p, t) matrix(c(0.2 * u[1], 0.1, 0.1, 0.2 * u[2]), 2, 2)
prob <- SDEProblem(f, g, c(1, 1), c(0, 1), noise_rate_prototype = matrix(0, 2, 2))
sol <- solve(prob, RKMilGeneral(p = 5), dt = 0.1, adaptive = FALSE, seed = 1)
sol$u[[11]]
#> [1] 0.4630580 0.4647174