SciML / StochasticDiffEq.jl

Solvers for stochastic differential equations which connect with the scientific machine learning (SciML) ecosystem
Other
237 stars 65 forks source link

DynamicalSDE with scale_noise=false #558

Closed Lightup1 closed 7 months ago

Lightup1 commented 7 months ago

The integration result is dependent on dt if we set gamma=0, scale_noise=false. Code example:

using DifferentialEquations
using Random
Random.seed!(1)
function f1(dv,v,u,p,t)
    dv.=0
end
function f2(du,v,u,p,t)
    du.=v
end
function f3(du,u,p,t)
    du[1]=1
end
W=WienerProcess(0.0,0.0,0.0)
prob=DynamicalSDEProblem(f1,f2,f3,[0.0],[0.0],(0.0,1.0),noise=W)
sol_SDE=solve(prob,BAOAB(gamma=0.0, scale_noise=false);dt=0.0001,saveat=0.01)

Possible cause: In alg cache, we have c2=1 when scale_noise == false. However, if c2 = 1, in perform_step!, we should have du3 = c1*du2 + c2*noise*sqdt. A more straightforward way is to let noise = integrator.g(u2,p,t+dt*half).*W.dW. I am not sure whether this is the most efficient and accurate implementation.