You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using new CoupledSDEs from DynamicalSystemsBase (#116)
* load CoupledSDEs from DynamicalSystemsBase v3.11
* worked on compatibility with new CoupledSDEs
* updated LDT functions, made om_action require noise_strength input
* export functions from StochasticSystemsBase
* worked on updating tests
* CoupledSDEs test's
* try out new format action
* turn on all tests
* format
* fix downgrade compat
up JET compat
fix downgrade compat?
fix downgrade compat?
fix downgrade compat?
up StochasticDiffEq compat
* better format CI
try another format github action
turn on formatter in PR
* update code example in README
* fixed Large Deviations tests by normalizing covariance matrix
* updated simulation functions
* added simulation tests
* removed 'simulate', renamed 'relax' to 'deterministic_orbit'
* tried to fix docs, still not finding docstrings from DynamicalSystemsBase
* add stochasticSystemsBase do docs modules
* fixed typo in makedocs
* exported missing functions, removed unneeded dep
* worked on fixing docs errors
* added dependency to docs
* added another dep to docs
* updated changelog to v0.4.0
* fixed errors in docstrings
---------
Co-authored-by: Orjan Ameye <orjan.ameye@hotmail.com>
Copy file name to clipboardExpand all lines: CHANGELOG.md
+22Lines changed: 22 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,27 @@
1
1
# Changelog for `CriticalTransitions.jl`
2
2
3
+
## v0.4.0
4
+
New `CoupledSDEs` design
5
+
6
+
This release upgrades CriticalTransitions.jl to be compatible with the re-design of `CoupledSDEs`, which has now been integrated in [`DynamicalSystemsBase.jl v3.11`](https://juliadynamics.github.io/DynamicalSystemsBase.jl/stable/CoupledSDEs/).
7
+
8
+
Since we have updated the syntax of defining a `CoupledSDEs` system, this is a breaking change.
9
+
10
+
#### Changed functions
11
+
-`CoupledSDEs` is now constructed with different args and kwargs
12
+
-`fw_action`, `geometric_action` and `om_action` now normalize the covariance matrix when computing the action functional
13
+
-`noise_strength` is not a function anymore but a kwarg for `CoupledSDEs` and other functions
14
+
-`om_action` now requires `noise_strength` as input argument
15
+
-`relax` was renamed to `deterministic_orbit`
16
+
-`trajectory` has been added to replace `simulate`
17
+
18
+
#### Deprecations
19
+
-`add_noise_strength`, `idfunc` and `idfunc!` are no longer needed and have been removed
20
+
- the function `noise_strength(::CoupledSDEs)` has been removed
21
+
-`simulate` has been removed
22
+
23
+
Full changelog [here](https://github.com/JuliaDynamics/CriticalTransitions.jl/compare/v0.3.0...v0.4.0).
where $\vec x \in \mathbb{R}^\text{D}$, $\sigma > 0$ is the noise strength, $\text{d}\mathcal{W}=\Gamma \cdot \text{d}\mathcal{N}$, and $\mathcal N$ denotes a stochastic process. The (positive definite) noise covariance matrix is $\Sigma = \Gamma \Gamma^\top \in \mathbb R^{N\times N}$.
9
-
10
-
The function $f$ is the deterministic part of the system and follows the syntax of a `ContinuousTimeDynamicalSystem` in [DynamicalSystems.jl](https://juliadynamics.github.io/DynamicalSystems.jl/latest/tutorial/), i.e., `f(u, p, t)` for out-of-place (oop) and `f!(du, u, p, t)` for in-place (iip). The function $g$ allows to specify the stochastic dynamics of the system along with the [noise process](#noise-process) $\mathcal{W}$. It should be of the same type (iip or oop) as $f$.
11
-
12
-
By combining $\sigma$, $g$ and $\mathcal{W}$, you can define different type of stochastic systems. Examples of different types of stochastic systems can be found on the [StochasticDiffEq.jl tutorial page](https://docs.sciml.ai/DiffEqDocs/stable/tutorials/sde_example/). A quick overview of common types of stochastic systems can be found [below](#Type-of-stochastic-system).
13
6
14
7
!!! info
15
8
Note that nonlinear mixings of the Noise Process $\mathcal{W}$ fall into the class of random ordinary differential equations (RODEs) which have a separate set of solvers. See [this example](https://docs.sciml.ai/DiffEqDocs/stable/tutorials/rode_example/) of DifferentialEquations.jl.
When `g \, \text{d}\mathcal{W}` is independent of the state variables `u`, the noise is called additive.
34
32
35
-
#### Diagonal noise
36
-
A system of diagonal noise is the most common type of noise. It is defined by a vector of random numbers `dW` whose size matches the output of `g` where the noise is applied element-wise, i.e. `g.*dW`.
33
+
### Additive noise
34
+
When $g(u, p, t)$ is independent of the state $u$, the noise is called additive; otherwise, it is multiplicative.
35
+
We can define a simple additive noise system as follows:
We defined a Wiener process `W`, whose increments are vectors of normally distributed random numbers of length matching the output of `g`. The noise is applied element-wise, i.e., `g.*dW`. Since the noise processes are uncorrelated, meaning the covariance matrix is diagonal, this type of noise is referred to as diagonal.
48
+
49
+
We can sample a trajectory from this system using the `trajectory` function also used for the deterministic systems:
In the case of correlated noise, the random numbers in a vector increment `dW` are correlated. This can be achieved by specifying the covariance matrix $\Sigma$ via the `covariance` keyword:
The vector `dW` is by default zero mean white gaussian noise $\mathcal{N}(0, \text{d}t)$ where the variance is the timestep $\text{d}t$ unit variance (Wiener Process).
63
+
Alternatively, we can parametrise the covariance matrix by defining the diffusion function $g$ ourselves:
Here, we had to provide `noise_prototype` to indicate that the diffusion function `g` will output a 2x2 matrix.
56
69
57
70
#### Scalar noise
58
-
Scalar noise is where a single random variable is applied to all dependent variables. To do this, one has to give the noise process to the `noise` keyword of the `CoupledSDEs` constructor. A common example is the Wiener process starting at `W0=0.0` at time `t0=0.0`.
59
-
71
+
If all state variables are forced by the same single random variable, we have scalar noise.
72
+
To define scalar noise, one has to give an one-dimensional noise process to the `noise_process` keyword of the `CoupledSDEs` constructor.
We can see that noise applied to each variable is the same.
82
+
83
+
### Multiplicative and time-dependent noise
84
+
In the SciML ecosystem, multiplicative noise is defined through the condition $g_i(t, u)=a_i u$. However, in the literature the name is more broadly used for any situation where the noise is non-additive and depends on the state $u$, possibly also in a non-linear way. When defining a `CoupledSDEs`, we can make the noise term time- and state-dependent by specifying an explicit time- or state-dependence in the noise function `g`, just like we would define `f`. For example, we can define a system with temporally decreasing multiplicative noise as follows:
69
85
```@example type
70
-
function g(du, u, p, t)
71
-
du[1] = σ*u[1]
72
-
du[2] = σ*u[2]
86
+
function g!(du, u, p, t)
87
+
du .= u ./ (1+t)
73
88
return nothing
74
89
end
75
-
sde = CoupledSDEs(f!, g, rand(2)./10)
76
-
sol = simulate(sde, 1.0, dt=0.01, alg=SOSRI())
77
-
plot(sol)
90
+
sde = CoupledSDEs(f!, rand(2)./10; g=g!)
78
91
```
79
92
80
93
#### Non-diagonal noise
81
-
Non-diagonal noise allows for the terms to linearly mixed via g being a matrix. Suppose we have two Wiener processes and two dependent random variables such that the output of `g` is a 2x2 matrix. Therefore, we have
94
+
Non-diagonal noise allows for the terms to be linearly mixed (correlated) via `g` being a matrix. Suppose we have two Wiener processes and two state variables such that the output of `g` is a 2x2 matrix. Therefore, we have
To indicate the structure that `g` should have, we can use the `noise_rate_prototype` keyword. Let us define a special type of non-diagonal noise called commutative noise. For this we can utilize the `RKMilCommute` algorithm which is designed to utilise the structure of commutative noise.
99
+
To indicate the structure that `g` should have, we must use the `noise_prototype` keyword. Let us define a special type of non-diagonal noise called commutative noise. For this we can utilize the `RKMilCommute` algorithm which is designed to utilize the structure of commutative noise.
Non-diagonal problems need specific type of solvers. See the [SciML recommendations](https://docs.sciml.ai/DiffEqDocs/stable/solvers/sde_solve/#sde_solve).
We provide the noise processes $\mathcal{W}$ that can be used in the stochastic simulations through the [DiffEqNoiseProcess.jl](https://docs.sciml.ai/DiffEqNoiseProcess/stable) package. A complete list of the available processes can be found [here](https://docs.sciml.ai/DiffEqNoiseProcess/stable/noise_processes/). We list some of the most common ones below:
117
-
```@docs
118
-
WienerProcess
119
-
SimpleWienerProcess
120
-
OrnsteinUhlenbeckProcess
121
-
CorrelatedWienerProcess
122
-
```
115
+
Non-diagonal problems need specific solvers. See the [SciML recommendations](https://docs.sciml.ai/DiffEqDocs/stable/solvers/sde_solve/#sde_solve).
123
116
124
117
## Interface to `DynamicalSystems.jl`
125
118
#### Converting between `CoupledSDEs` and `CoupledODEs`
@@ -128,8 +121,8 @@ CorrelatedWienerProcess
128
121
The deterministic part of a [`CoupledSDEs`](@ref) system can easily be extracted as a
129
122
[`CoupledODEs`](https://juliadynamics.github.io/DynamicalSystems.jl/dev/tutorial/#DynamicalSystemsBase.CoupledODEs), a common subtype of a `ContinuousTimeDynamicalSystem` in DynamicalSystems.jl.
130
123
131
-
-`CoupledODEs(sde::CoupledSDEs)` extracts the deterministic part of `sde` as a `CoupledODEs`
132
-
-`CoupledSDEs(ode::CoupledODEs, g)`, with `g` the noise function, turns `ode` into a `CoupledSDEs`
124
+
-`CoupledODEs(sde::CoupledSDEs)` extracts the deterministic part of `sde` as a `CoupledODEs`.
125
+
-`CoupledSDEs(ode::CoupledODEs; kwargs)`turns `ode` into a `CoupledSDEs`.
133
126
134
127
```@docs
135
128
CoupledODEs
@@ -152,6 +145,8 @@ function fitzhugh_nagumo(u, p, t)
0 commit comments