Closed oameye closed 2 months ago
Yes, we thought about this as well back then when writing the StochSystem
struct. The reason why we did this is that the SDEProblem
from DiffEq only has one parameter field p
for both the deterministic function f
and the noise function g
. However, in the StochSystem
struct, we wanted to have the deterministic and stochastic parameters separately because the idea is to e.g. take a deterministic system with a set of parameters and throw different noise terms at it which might have different numbers of parameters.
Ideally, f(u,p,t)
would take in a Vector
for p
(and not Vector{Vector}
) and behind the scenes the StochSystem
would sort this together with the stochastic parameters pg
to pass it to SDEProblem
in a way that still works. Any ideas on how to best do this are very welcome :)
Ideally,
f(u,p,t)
would take in aVector
forp
(and notVector{Vector}
) and behind the scenes theStochSystem
would sort this together with the stochastic parameterspg
to pass it toSDEProblem
in a way that still works. Any ideas on how to best do this are very welcome :)
I think we can work this out. I will start a PR
I have been looking into how StochasticDiffEq does parameter handling and it seems to opt for one iterator (vector, tuple, etc.) where the functions f
or g
know which index to call for a specific param. I would try to mimic this framework such that we have a smooth interplay between ModelingToolkit and StochasticDiffEq. We should do this in parallel with #75.
Now the user is expected construct their deterministic function in a way that it takes in parameter of the form
[dp, sp]
withdp
the deterministic vector of parameters andsp
the stochastic vector of parameters. However, this makes it dificult to convert deterministic ODE of other packages from DynamicalSystems, OrdinaryDiffEq and HarmonicBalance. Instead, I propose we change handling of the parameters in such a way that the deterministic functionf(u, p, t)
takes in aVector
instead ofVector{Vector}
.https://github.com/JuliaDynamics/CriticalTransitions.jl/blob/09bb88dc69fdf2d119e5dfd6e60c064234308abc/docs/src/tutorial.md?plain=1#L27-L35