I am trying to implement a stochastic differential equation for an SDE representing a biological system, so the variable (concentration) should not be negative.
In order to modelize a noise process that cannot be negative when the concentration is already 0 or close to 0, I decided to use a NoiseTransport process, as I do not see any other way to do it, at least from reading the documentation.
To make sure I understood everything, I decided to first toy with the examples provided in the doc: a 3d lorentz system (taken from doc):
using DifferentialEquations
using Plots
using Random
using Random: randn!
function lorenz(du, u, p, t)
du[1] = 10.0(u[2] - u[1])
du[2] = u[1] * (28.0 - u[3]) - u[2]
du[3] = u[1] * u[2] - (8 / 3) * u[3]
end
function σ_lorenz(du, u, p, t)
du[1] = 5.0
du[2] = 5.0
du[3] = 5.0
end
Onto which I apply the Transport noise (also taken from the doc)
function f!(out, u, p, t, v)
println(v) # to check if noise is generated correctly
out[1] = sin(v[1] * t)
out[2] = sin(t + v[2])
out[3] = cos(t) * v[1] + sin(t) * v[2]
nothing
end
t0 = 0.0
RV!(v) = (v[1] = randn(1); v[2] = rand(1))
rv = zeros(2)
W = NoiseTransport(t0, f!, RV!, rv, noise_prototype = zeros(3))
I then solve the SDE by running the following snipet (again from the doc)
prob_sde_lorenz = SDEProblem(lorenz, σ_lorenz, [1.0, 0.0, 0.0], (0.0, 10.0), noise = W)
sol = solve(prob_sde_lorenz)
plot(sol, idxs = (1, 2, 3))
When I run this code, I see that the transport noise only generates [0, 0]
which completely defeats the purpose. Any other variants of this that I tried, however simple, gave the same result. How can this be, since this is taken from the documentation?
Did I misunderstood the purpose of the transport noise? If so, how could I generate a noise that can only be negative when another variable is not 0?