Skip to contents

SDEIntegrator is the class of the integrators init() returns for SDE problems (they are also ODEIntegrator objects, with the same stepping interface). SDEOptions(...) collects solver options of an SDE solve with the defaults of StochasticDiffEq, for do.call(solve, c(list(prob, alg), opts)). concrete_prob(prob) is the differential equation problem a problem carries: the problem itself, or the wrapped problem of a JumpProblem(). alg_cache(alg, prob, u, t) builds the cache an algorithm starts a solve with (the state its stepping keeps). The integrator hooks initialize_callback(cb, u, t, integrator) and finalize(cb, u, t, integrator) run the initialize and finalize functions of a callback or callback set (initialize! and finalize! upstream), and addsteps(integrator) computes the extra interpolation stages of the current step, of which SDE integrators, interpolated linearly, have none.

Usage

SDEIntegrator

SDEOptions(
  abstol = 0.01,
  reltol = 0.01,
  qmax = 9/8,
  qmin = 1/5,
  gamma = 9/10,
  delta = NULL,
  maxiters = 1e+07,
  dtmax = NULL,
  adaptive = NULL,
  save_everystep = TRUE,
  ...
)

concrete_prob(prob)

alg_cache(alg, prob, u = prob$u0, t = prob$tspan[1L])

initialize_callback(cb, u, t, integrator)

finalize(cb, u, t, integrator)

addsteps(integrator, ...)

Arguments

abstol, reltol

Tolerances.

qmax, qmin, gamma

Step size controller limits and safety factor.

delta

The weight of the drift error estimate.

maxiters

The largest number of steps.

dtmax

The largest step size, or NULL.

adaptive

Adaptive stepping, or NULL for the method's default.

save_everystep

Save every step.

...

Further options.

prob

A problem.

alg

An algorithm.

u, t

The state and time to start from.

cb

A callback or callback set.

integrator

An integrator.

Value

SDEIntegrator is a class name; SDEOptions() a list of class SDEOptions; concrete_prob() a problem; alg_cache() the cache; the hooks return the integrator invisibly.

Examples

prob <- SDEProblem(function(u, p, t) -u, function(u, p, t) 0.1 * u, 1, c(0, 1))
integ <- init(prob, SOSRI(), seed = 1)
inherits(integ, SDEIntegrator)
#> [1] TRUE
opts <- SDEOptions(abstol = 1e-3)
sol <- do.call(solve, c(list(prob, SOSRI()), opts, seed = 1))
identical(concrete_prob(prob), prob)
#> [1] TRUE
names(alg_cache(Tsit5(), ODEProblem(function(u, p, t) -u, 1, c(0, 1))))
#> [1] "fsal"
class(alg_cache(ImplicitEM(), prob))
#> [1] "environment"