@@ -37,17 +37,16 @@ for the numerical integrator, and solve it.
3737
3838``` julia
3939using DifferentialEquations, ModelingToolkit
40+ using ModelingToolkit: t_nounits as t, D_nounits as D
4041
4142@parameters σ ρ β
42- @variables t x (t) y (t) z (t)
43- D = Differential (t)
43+ @variables x (t) y (t) z (t)
4444
4545eqs = [D (D (x)) ~ σ * (y - x),
4646 D (y) ~ x * (ρ - z) - y,
4747 D (z) ~ x * y - β * z]
4848
49- @named sys = ODESystem (eqs)
50- sys = structural_simplify (sys)
49+ @mtkbuild sys = ODESystem (eqs)
5150
5251u0 = [D (x) => 2.0 ,
5352 x => 1.0 ,
@@ -75,23 +74,22 @@ Equation (DAE):
7574
7675``` julia
7776using DifferentialEquations, ModelingToolkit
77+ using ModelingToolkit: t_nounits as t, D_nounits as D
7878
7979@parameters σ ρ β
80- @variables t x (t) y (t) z (t)
81- D = Differential (t)
80+ @variables x (t) y (t) z (t)
8281
8382eqs = [D (x) ~ σ * (y - x),
8483 D (y) ~ x * (ρ - z) - y,
8584 D (z) ~ x * y - β * z]
8685
87- @named lorenz1 = ODESystem (eqs)
88- @named lorenz2 = ODESystem (eqs)
86+ @mtkbuild lorenz1 = ODESystem (eqs)
87+ @mtkbuild lorenz2 = ODESystem (eqs)
8988
9089@variables a (t)
9190@parameters γ
9291connections = [0 ~ lorenz1. x + lorenz2. y + a * γ]
93- @named connected = ODESystem (connections, t, [a], [γ], systems = [lorenz1, lorenz2])
94- sys = structural_simplify (connected)
92+ @mtkbuild connected = ODESystem (connections, t, [a], [γ], systems = [lorenz1, lorenz2])
9593
9694u0 = [lorenz1. x => 1.0 ,
9795 lorenz1. y => 0.0 ,
@@ -110,7 +108,7 @@ p = [lorenz1.σ => 10.0,
110108 γ => 2.0 ]
111109
112110tspan = (0.0 , 100.0 )
113- prob = ODEProblem (sys , u0, tspan, p)
111+ prob = ODEProblem (connected , u0, tspan, p)
114112sol = solve (prob)
115113
116114using Plots
0 commit comments