JuliaDynamics / DynamicalSystemsBase.jl

Definition of dynamical systems and integrators for DynamicalSystems.jl
Other
53 stars 27 forks source link

Add `CoupledSDEs` system struct #202

Open reykboerner opened 4 months ago

reykboerner commented 4 months ago

As discussed with @Datseris, we could add the possibility of defining an SDE system as a type of DynamicalSystem. This type would allow to add stochastic dynamics, and it would limit to CoupledODEs for vanishing noise.

Such a type already exists in CriticalTransitions.jl, where it is called StochSystem. We could migrate it here. It is motivated by the way one would commonly write down a fairly general SDE:

image

The struct is currently written as follows:

struct StochSystem
    f::Function
    pf::Parameters
    u::State
    σ::Float64
    g::Function
    pg::Parameters
    Σ::CovMatrix
    process::Any
end;

Things to discuss:

Datseris commented 4 months ago

i will review soon i will promise i m just a bit busy!!!

Datseris commented 4 months ago

It should be called CoupledSDEs. Your outline is fine, but the structure needs more things.

First, we need to consider the symbolic aspect. This type should integrate with Modeling toolkit.jl. why do we need two separated parameter containers? Is it because we have a dedicated function for the noise term?

I am confused. Why do you need both σ and Pg?

Also, why do you need both a covariance matrix and a g function ? Doesn't the vector function g already contain all info including cross coupling...?

We could also allow the noise to be a vector of noises, one for each stare.

In general if we can simplify so that there aren't so many inputs that would be great. You can always add convenience constructors later if you want to place signa at a special place.

Lastly the type must satisfy the dynamical system API.have a look at the source code of CoupledODEs. It should show you everything you need I will help in the pr.

oameye commented 2 months ago

I started something in this direction in this PR. After, I finished the transition for CriticalTransitions.jl, the type CoupledSDEs can be moved to DynamicalSystemsBase.

Datseris commented 2 months ago

I'd suggest to open the PR here directly. The PR you cited has 28 files changed, I won't be able to review that. Better to start something very focused here and simply parallel the CoupledODEs file.

oameye commented 2 months ago

I see your viewpoint. But I think for us it is better to work on a branch in Criticaltransitions.jl so that we can slowly understand what we need and first internally make some decisions. After this, we will open a PR where we introduce the code related to CoupledSDEs.