Hi everyone,
I’m working on a problem where I have a large set of differential equations. Noise is added to the system in two ways, by sampling the initial condition for many simulations and by explicitly adding noise in only one of the differential equations. It’s the second part that has me wondering if my implementation is correct.
The deterministic part is
param=[0.0, Jm, Uv, γv, zeros(Float64,M), dWv]
function du_det!(du,u,p,t)
Jm,Uv,γv,D=p
mul!(D,Jm,u)
@inbounds @. du = im*D - (im*Uv*abs2(u)+γv)*u
end
Where Jm
, γv
and Uv
are predefined arrays and M
the size of the array u
. For the stochastic part I take
function du_stoch!(du,u,p,t)
du[:].=p[6][:]
end
I want only the equation for u[N]
to be stochastic so I usually have dWv = zeros(Float64,M); dWv[N] = 1.0
. However when running this and pulling the noise
prob=SDEProblem(du_det!, du_stoch!, ψ0[1], (0.0,1.0), param)
sol=solve(prob,SOSRA(),dt=0.001,adaptive=true,save_noise=true,saveat=0.01)
I find that sol.W
is nonzero for the other equations. Does anyone know how I can correctly implement my problem?
Thanks in advance and apologies if the answer is trivial, my experience with Julia is limited.