@@ -50,16 +50,14 @@ number of animals at each time?
50
50
51
51
``` @example
52
52
using ModelingToolkit, DifferentialEquations, Plots
53
+ using ModelingToolkit: t_nounits as t, D_nounits as D
53
54
54
55
# Define our state variables: state(t) = initial condition
55
- @variables t x(t)=1 y(t)=1 z(t)
56
+ @variables x(t)=1 y(t)=1 z(t)
56
57
57
58
# Define our parameters
58
59
@parameters α=1.5 β=1.0 γ=3.0 δ=1.0
59
60
60
- # Define our differential: takes the derivative with respect to `t`
61
- D = Differential(t)
62
-
63
61
# Define the differential equations
64
62
eqs = [D(x) ~ α * x - β * x * y
65
63
D(y) ~ -γ * y + δ * x * y
@@ -103,6 +101,7 @@ Now we're ready. Let's load in these packages:
103
101
104
102
``` @example first_sim
105
103
using ModelingToolkit, DifferentialEquations, Plots
104
+ using ModelingToolkit: t_nounits as t, D_nounits as D
106
105
```
107
106
108
107
### Step 2: Define our ODE Equations
@@ -113,7 +112,7 @@ variables:
113
112
114
113
``` @example first_sim
115
114
# Define our state variables: state(t) = initial condition
116
- @variables t x(t)=1 y(t)=1 z(t)
115
+ @variables x(t)=1 y(t)=1 z(t)
117
116
```
118
117
119
118
Notice here that we use the form ` state = default ` , where on the right-hand side the default
@@ -135,9 +134,6 @@ This is then done similarly for parameters, where the default value is now the p
135
134
expressions!
136
135
137
136
Next, we define our set of differential equations.
138
- To define the ` Differential ` operator ` D ` , we need to first tell it what to
139
- differentiate with respect to, here the independent variable ` t ` ,
140
- Then, once we have the operator, we apply that into the equations.
141
137
142
138
!!! note
143
139
@@ -148,9 +144,6 @@ Then, once we have the operator, we apply that into the equations.
148
144
is used!
149
145
150
146
``` @example first_sim
151
- # Define our differential: takes the derivative with respect to `t`
152
- D = Differential(t)
153
-
154
147
# Define the differential equations
155
148
eqs = [D(x) ~ α * x - β * x * y
156
149
D(y) ~ -γ * y + δ * x * y
0 commit comments