Skip to content

Commit 857f212

Browse files
Update first_simulation.md
1 parent 85e144a commit 857f212

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

docs/src/getting_started/first_simulation.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,14 @@ number of animals at each time?
5050

5151
```@example
5252
using ModelingToolkit, DifferentialEquations, Plots
53+
using ModelingToolkit: t_nounits as t, D_nounits as D
5354
5455
# 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)
5657
5758
# Define our parameters
5859
@parameters α=1.5 β=1.0 γ=3.0 δ=1.0
5960
60-
# Define our differential: takes the derivative with respect to `t`
61-
D = Differential(t)
62-
6361
# Define the differential equations
6462
eqs = [D(x) ~ α * x - β * x * y
6563
D(y) ~ -γ * y + δ * x * y
@@ -103,6 +101,7 @@ Now we're ready. Let's load in these packages:
103101

104102
```@example first_sim
105103
using ModelingToolkit, DifferentialEquations, Plots
104+
using ModelingToolkit: t_nounits as t, D_nounits as D
106105
```
107106

108107
### Step 2: Define our ODE Equations
@@ -113,7 +112,7 @@ variables:
113112

114113
```@example first_sim
115114
# 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)
117116
```
118117

119118
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
135134
expressions!
136135

137136
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.
141137

142138
!!! note
143139

@@ -148,9 +144,6 @@ Then, once we have the operator, we apply that into the equations.
148144
is used!
149145

150146
```@example first_sim
151-
# Define our differential: takes the derivative with respect to `t`
152-
D = Differential(t)
153-
154147
# Define the differential equations
155148
eqs = [D(x) ~ α * x - β * x * y
156149
D(y) ~ -γ * y + δ * x * y

0 commit comments

Comments
 (0)