@@ -5,7 +5,7 @@ to the model: randomness. This is a
5
5
[ stochastic differential equation] ( https://en.wikipedia.org/wiki/Stochastic_differential_equation )
6
6
which has a deterministic (drift) component and a stochastic (diffusion)
7
7
component. Let's take the Lorenz equation from the first tutorial and extend
8
- it to have multiplicative noise.
8
+ it to have multiplicative noise by creating ` @brownian ` variables in the equations .
9
9
10
10
``` @example SDE
11
11
using ModelingToolkit, StochasticDiffEq
@@ -14,16 +14,12 @@ using ModelingToolkit: t_nounits as t, D_nounits as D
14
14
# Define some variables
15
15
@parameters σ ρ β
16
16
@variables x(t) y(t) z(t)
17
+ @brownian a
18
+ eqs = [D(x) ~ σ * (y - x) + 0.1a * x,
19
+ D(y) ~ x * (ρ - z) - y + 0.1a * y,
20
+ D(z) ~ x * y - β * z + 0.1a * z]
17
21
18
- eqs = [D(x) ~ σ * (y - x),
19
- D(y) ~ x * (ρ - z) - y,
20
- D(z) ~ x * y - β * z]
21
-
22
- noiseeqs = [0.1 * x,
23
- 0.1 * y,
24
- 0.1 * z]
25
-
26
- @mtkbuild de = SDESystem(eqs, noiseeqs, t, [x, y, z], [σ, ρ, β])
22
+ @mtkbuild de = System(eqs, t)
27
23
28
24
u0map = [
29
25
x => 1.0,
@@ -38,5 +34,5 @@ parammap = [
38
34
]
39
35
40
36
prob = SDEProblem(de, u0map, (0.0, 100.0), parammap)
41
- sol = solve(prob, SOSRI ())
37
+ sol = solve(prob, LambdaEulerHeun ())
42
38
```
0 commit comments