@@ -22,7 +22,7 @@ function decay(; name)
2222 @variables x(t) f(t)
2323 D = Differential(t)
2424 ODESystem([
25- D(x) ~ -a * x + f,
25+ D(x) ~ -a * x + f
2626 ];
2727 name = name)
2828end
3232
3333@parameters t
3434D = Differential(t)
35- connected = compose(ODESystem([decay2.f ~ decay1.x
36- D(decay1.f) ~ 0], t; name = :connected), decay1, decay2)
35+ connected = compose(
36+ ODESystem([decay2.f ~ decay1.x
37+ D(decay1.f) ~ 0], t; name = :connected), decay1, decay2)
3738
3839equations(connected)
3940
@@ -52,10 +53,10 @@ Now we can solve the system:
5253
5354``` @example composition
5455x0 = [decay1.x => 1.0
55- decay1.f => 0.0
56- decay2.x => 1.0]
56+ decay1.f => 0.0
57+ decay2.x => 1.0]
5758p = [decay1.a => 0.1
58- decay2.a => 0.2]
59+ decay2.a => 0.2]
5960
6061using DifferentialEquations
6162prob = ODEProblem(simplified_sys, x0, (0.0, 100.0), p)
@@ -96,7 +97,7 @@ in their namespaced form. For example:
9697
9798``` julia
9899u0 = [x => 2.0
99- subsys. x => 2.0 ]
100+ subsys. x => 2.0 ]
100101```
101102
102103Note that any default values within the given subcomponent will be
@@ -210,19 +211,27 @@ N = S + I + R
210211@named ieqn = ODESystem([D(I) ~ β * S * I / N - γ * I])
211212@named reqn = ODESystem([D(R) ~ γ * I])
212213
213- sir = compose(ODESystem([
214+ sir = compose(
215+ ODESystem(
216+ [
214217 S ~ ieqn.S,
215218 I ~ seqn.I,
216219 R ~ ieqn.R,
217220 ieqn.S ~ seqn.S,
218221 seqn.I ~ ieqn.I,
219222 seqn.R ~ reqn.R,
220223 ieqn.R ~ reqn.R,
221- reqn.I ~ ieqn.I], t, [S, I, R], [β, γ],
224+ reqn.I ~ ieqn.I],
225+ t,
226+ [S, I, R],
227+ [β, γ],
222228 defaults = [seqn.β => β
223- ieqn.β => β
224- ieqn.γ => γ
225- reqn.γ => γ], name = :sir), seqn, ieqn, reqn)
229+ ieqn.β => β
230+ ieqn.γ => γ
231+ reqn.γ => γ], name = :sir),
232+ seqn,
233+ ieqn,
234+ reqn)
226235```
227236
228237Note that the states are forwarded by an equality relationship, while
@@ -244,7 +253,7 @@ u0 = [seqn.S => 990.0,
244253 reqn.R => 0.0]
245254
246255p = [β => 0.5
247- γ => 0.25]
256+ γ => 0.25]
248257
249258tspan = (0.0, 40.0)
250259prob = ODEProblem(sireqn_simple, u0, tspan, p, jac = true)
0 commit comments