@@ -5,7 +5,7 @@ to the model: randomness. This is a
55[ stochastic differential equation] ( https://en.wikipedia.org/wiki/Stochastic_differential_equation )
66which has a deterministic (drift) component and a stochastic (diffusion)
77component. 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 .
99
1010``` @example SDE
1111using ModelingToolkit, StochasticDiffEq
@@ -14,16 +14,12 @@ using ModelingToolkit: t_nounits as t, D_nounits as D
1414# Define some variables
1515@parameters σ ρ β
1616@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]
1721
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)
2723
2824u0map = [
2925 x => 1.0,
@@ -38,5 +34,5 @@ parammap = [
3834]
3935
4036prob = SDEProblem(de, u0map, (0.0, 100.0), parammap)
41- sol = solve(prob, SOSRI ())
37+ sol = solve(prob, LambdaEulerHeun ())
4238```
0 commit comments