Open awage opened 3 weeks ago
If you look at #212 it was quite a bit of work and back and forth. I think the whole process took a couple of months on and off... :D @oameye was the main driver so he can write about how hard it was.
For me what was mindblowing was that Attractors.jl worked out of the box for a multistable SDE FitzHugh Nagumo. We didn't have to change anything there !
With DDEs we have a problem to solve: what would be dimension(ds)
? As DDEs are effectively infinitely dimensional. What would be current_state(ds)
? What sorts of additional quierying function you would need? Would the delay time be part of the parameters or something special like the σ
of the SDEs?
I know nearly nothing about how numerically solving a DDE works unless you do it in discretized time. And I'd guess some knowledge on that front would be important to know how to handle this object as a dynamical system.
But in principle, as long as this implements the DynamicalSystem
api, that's all we need.
I had a first try at defining CoupledDDES
and it works for the examples I tried.
function duffing_delay!(du, u, h, p, t)
α = p[1]; F = p[2]; ω = p[3]; tau = p[4]
hist = h(p, t - tau)[1]
du[1] = -u[1]*((1+α)*u[1]^2 -1) + α*hist + F*sin(ω*t)
end
α = -0.925; F = 0.525; ω = 1.; tau = 1.065; x = 1.; y = 1.;
lags = [tau];
h(p,t) = [x,y]
u0 = [x, y]
ds = CoupledDDEs(duffing_delay!, u0, [α, F, ω, tau]; h = h, constant_lags = lags)
y,t = trajectory(ds, 1000)
It just works!
Now, before beginning the PR process I have to design tests. But it will be very similar to the architecture of CoupledSDE
It may take a while.
With DDEs we have a problem to solve: what would be
dimension(ds)
? As DDEs are effectively infinitely dimensional. What would becurrent_state(ds)
? What sorts of additional quierying function you would need? Would the delay time be part of the parameters or something special like theσ
of the SDEs?
Before tests you need to figure out the above, as they are conceptual issues, not technical.
But it is of course fantastic that things work straightforwardly :) yet another testament of how nice is the DynamicalSystem
interface. Which makes sense as it has been through 4 reworks... :P
I literally copied the file continuous_time_sde.jl
and replaced SDE for DDE everywhere. Some small changes here and there and it worked.
For your specific questions:
dimension(ds) ->
dimension of the state vector. current_state(ds) ->
state vector.
Maybe you can request the history function h
. Although I would ask the DelayDiffEq.jl
gurus for pointers.
I saw the fantastic work on CoupledSDEs. What about other specialized solvers? In particular DDEs or of interest in the dynamical system community.
At first sight a wrapper around DDEProblem should be doable.
Any thoughts based on your experience integrating SDEs?