Closed rmsrosa closed 2 years ago
For example. With
using StochasticDiffEq, DiffEqNoiseProcess f(u, p, t, Y) = Y * u y(a, p, t) = -t Y = NoiseFunction(0.0, y, reset=true) u0 = 1.0 tspan = (0.0, 1.0) prob = RODEProblem(f, u0, tspan, noise=Y)
I get
julia> sol = solve(prob, RandomEM(), dt=1/100) retcode: Success Interpolation: 1st order linear t: 101-element Vector{Float64}: 0.0 0.01 ⋮ 1.0 u: 101-element Vector{Float64}: 1.0 1.0 ⋮ 0.6085659649572785 julia> sol = solve(prob, RandomEM(), dt=1/100) retcode: Success Interpolation: 1st order linear t: 101-element Vector{Float64}: 0.0 0.01 0.02 ⋮ 0.9800000000000006 0.9900000000000007 1.0 u: 101-element Vector{Float64}: 1.0 0.99 0.980001 ⋮ 0.23070445114140511 0.22613650300880528 0.22163638659893034
Notice u keeps decreasing (the decay rate Y does not reset for the new solves and keeps getting faster). After the third run, Y.curt is near 3.0:
u
Y
Y.curt
julia> Y.curt 2.9999999999999782
The problem is that solve expects the noise to have the field t, which is not the case for a NoiseFunction: https://github.com/SciML/StochasticDiffEq.jl/blob/master/src/solve.jl#L416
solve
t
NoiseFunction
For example. With
I get
Notice
u
keeps decreasing (the decay rateY
does not reset for the new solves and keeps getting faster). After the third run,Y.curt
is near 3.0:The problem is that
solve
expects the noise to have the fieldt
, which is not the case for aNoiseFunction
: https://github.com/SciML/StochasticDiffEq.jl/blob/master/src/solve.jl#L416