You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/tutorials/ode_modeling.md
+12-10Lines changed: 12 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,10 +37,8 @@ D = Differential(t) # define an operator for the differentiation w.r.t. time
37
37
```
38
38
39
39
Note that equations in MTK use the tilde character (`~`) as equality sign.
40
-
The `@named` macro just adds the keyword-argument `name` to the call of
41
-
`ODESystem`. Its value is the name of the variable the system is assigned to.
42
-
For this example, calling `fol_model = ODESystem(...; name=:fol_model)` would do
43
-
exactly the same.
40
+
Also note that the `@named` macro simply ensures that the symbolic name
41
+
matches the name in the REPL. If omitted, you can directly set the `name` keyword.
44
42
45
43
After construction of the ODE, you can solve it using [DifferentialEquations.jl](https://diffeq.sciml.ai/):
46
44
@@ -107,6 +105,10 @@ plot(sol, vars=[x, RHS])
107
105
108
106

109
107
108
+
Note that similarly the indexing of the solution works via the names, and so
109
+
`sol[x]` gives the timeseries for `x`, `sol[x,2:10]` gives the 2nd through 10th
110
+
values of `x` matching `sol.t`, etc. Note that this works even for variables
111
+
which have been eliminated, and thus `sol[RHS]` retrieves the values of `RHS`.
110
112
111
113
## Specifying a time-variable forcing function
112
114
What if the forcing function (the "external input") ``f(t)`` is not constant?

142
143
143
144
144
-
Note that for this problem, the implicit solver `Rodas4` is used, to cleanly resolve
145
-
the steps in the forcing function.
146
-
147
145
## Building component-based, hierarchical models
146
+
148
147
Working with simple one-equation systems is already fun, but composing more complex systems from
149
148
simple ones is even more fun. Best practice for such a "modeling framework" could be to use
150
149
@@ -275,6 +274,7 @@ partial derivatives, are not used. Let's benchmark this (`prob` still is the pro
The speedup is significant. For this small dense model (3 of 4 entries are populated), using sparse matrices is counterproductive in terms of required memory allocations. For large,
294
294
295
295
hierarchically built models, which tend to be sparse, speedup and the reduction of
296
-
memory allocation can be expected to be substantial.
296
+
memory allocation can be expected to be substantial. In addition, these problem
297
+
builders allow for automatic parallelism using the structural information. For
298
+
more information, see the [ODESystem](@ref ODESystem) page.
297
299
298
300
## Notes and pointers how to go on
299
301
Here are some notes that may be helpful during your initial steps with MTK:
0 commit comments