Why does this really simple linear SDE diverge?

using DifferentialEquations
using LinearAlgebra

N = 5
conn = -Matrix{Float64}(I, N, N)
sigma = Matrix{Float64}(I, N, N)
f(v, p, t) = conn * v
g(v, p, t) = sigma

Nt = 200
T = 100.0 # measured in seconds

prob = SDEProblem(f, g, zeros(N), (0.0, T), nothing)

function prob_func(prob, i, repeat)
    @. prob.u0 = randn()

ensembleprob = EnsembleProblem(prob; prob_func=prob_func)

sol = solve(ensembleprob, SOSRI(), EnsembleThreads(), trajectories = 10)

With additive noise, there’s no guarantee it stays positive. Once it goes negative it’s exponential growth with noise.

I don’t see how. This is just an Ornstein-Uhlenbeck SDE with noise, it should be stable.

1 Like

Oh wait I was wrong. Did you try just decreasing the integration tolerances?

Same issue occurs, even if I set abstol = 1e-14, reltol = 1e-14 and the solve function. Not sure why this would fail for such a simple test case.

Only with threading?