SciML / DiffEqNoiseProcess.jl

A library of noise processes for stochastic systems like stochastic differential equations (SDEs) and other systems that are present in scientific machine learning (SciML)
https://docs.sciml.ai/DiffEqNoiseProcess/stable/
Other
63 stars 29 forks source link

wiener_rand! dispatches incorrectly #156

Closed Jonas-a-Zimmermann closed 1 year ago

Jonas-a-Zimmermann commented 1 year ago

The function wiener_rand dispatches incorrectly.

This leads to inconsisency (and incorrect) solving of complex noise processes.

MWE:

using Random, DiffEqNoiseProcess, StochasticDiffEq

Random.seed!(12345)

wp  = WienerProcess(0., [(0. + 1im)])
prob    = NoiseProblem(wp, (0., 1.))
sol     = solve(prob, dt=0.1)
println("real: $(real(sol.u[end])), Im: $(imag(sol.u[end]))")

Produces the output: real: [-0.5617989142416906], Im: [1.0]

Random.seed!(12345)
wp  = WienerProcess!(0., [(0. + 1im)])
prob    = NoiseProblem(wp, (0., 1.))
sol     = solve(prob, dt=0.1)
println("real: $(real(sol.u[end])), Im: $(imag(sol.u[end]))")

real: [-0.800743866709594], Im: [0.7426141022492779]