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/introduction_to_catalyst/catalyst_for_new_julia_users.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -55,15 +55,15 @@ To import a Julia package into a session, you can use the `using PackageName` co
55
55
using Pkg
56
56
Pkg.add("Catalyst")
57
57
```
58
-
Here, the Julia package manager package (`Pkg`) is by default installed on your computer when Julia is installed, and can be activated directly. Next, we also wish to install the needed sub-libraries of `OrdinaryDiffEqTsit5` and `Plots` packages (for numeric simulation of models, and plotting, respectively). We will import the default recommende dsolver, `Tsit5()`, which is in the `OrdinaryDiffEqTsit5` sub-library. A full list of `OrdinaryDiffEq` solver sublibraries can be found on the sidebar of [this page](https://docs.sciml.ai/OrdinaryDiffEq/stable/).
58
+
Here, the Julia package manager package (`Pkg`) is by default installed on your computer when Julia is installed, and can be activated directly. Next, we also wish to install the needed sub-libraries of `OrdinaryDiffEq` and `Plots` packages (for numeric simulation of models, and plotting, respectively). We will import the default recommended solver from the `OrdinaryDiffEqDefault` sub-library. A full list of `OrdinaryDiffEq` solver sublibraries can be found on the sidebar of [this page](https://docs.sciml.ai/OrdinaryDiffEq/stable/).
59
59
```julia
60
-
Pkg.add("OrdinaryDiffEqTsit5")
60
+
Pkg.add("OrdinaryDiffEqDefault")
61
61
Pkg.add("Plots")
62
62
```
63
63
Once a package has been installed through the `Pkg.add` command, this command does not have to be repeated if we restart our Julia session. We can now import all three packages into our current session with:
64
64
```@example ex2
65
65
using Catalyst
66
-
using OrdinaryDiffEqTsit5
66
+
using OrdinaryDiffEqDefault
67
67
using Plots
68
68
```
69
69
Here, if we restart Julia, these `using` commands *must be rerun*.
Copy file name to clipboardExpand all lines: docs/src/inverse_problems/global_sensitivity_analysis.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ end
22
22
```
23
23
We will study the peak number of infected cases's ($max(I(t))$) sensitivity to the system's three parameters. We create a function which simulates the system from a given initial condition and measures this property:
Copy file name to clipboardExpand all lines: docs/src/model_creation/conservation_laws.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,11 +10,11 @@ end
10
10
```
11
11
If we simulate it, we note that while the concentrations of $X₁$ and $X₂$ change throughout the simulation, the total concentration of $X$ ($= X₁ + X₂$) is constant:
This makes sense, as while $X$ is converted between two different forms ($X₁$ and $X₂$), it is neither produced nor degraded. That is, it is a *conserved quantity*. Next, if we consider the ODE that our model generates:
@@ -47,15 +47,15 @@ Here, Catalyst encodes all conserved quantities in a single, [vector-valued](@re
47
47
48
48
Practically, the `remove_conserved = true` argument can be provided when a `ReactionSystem` is converted to an `ODEProblem`:
Here, while `Γ[1]` becomes a parameter of the new system, it has a [default value](@ref dsl_advanced_options_default_vals) equal to the corresponding conservation law. Hence, its value is computed from the initial condition `[:X₁ => 80.0, :X₂ => 20.0]`, and does not need to be provided in the parameter vector. Next, we can simulate and plot our model using normal syntax:
Copy file name to clipboardExpand all lines: docs/src/model_creation/dsl_advanced.md
+9-8Lines changed: 9 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -100,20 +100,20 @@ end
100
100
```
101
101
Next, if we simulate the model, we do not need to provide values for species or parameters that have default values. In this case all have default values, so both `u0` and `ps` can be empty vectors:
102
102
```@example dsl_advanced_defaults
103
-
using OrdinaryDiffEqTsit5, Plots
103
+
using OrdinaryDiffEqDefault, Plots
104
104
u0 = []
105
105
tspan = (0.0, 10.0)
106
106
p = []
107
107
oprob = ODEProblem(rn, u0, tspan, p)
108
-
sol = solve(oprob, Tsit5())
108
+
sol = solve(oprob)
109
109
plot(sol)
110
110
```
111
111
It is still possible to provide values for some (or all) initial conditions/parameters in `u0`/`ps` (in which case these overrides the default values):
112
112
```@example dsl_advanced_defaults
113
113
u0 = [:X => 4.0]
114
114
p = [:d => 0.5]
115
115
oprob = ODEProblem(rn, u0, tspan, p)
116
-
sol = solve(oprob, Tsit5())
116
+
sol = solve(oprob)
117
117
plot(sol)
118
118
```
119
119
It is also possible to declare a model with default values for only some initial conditions/parameters:
@@ -127,7 +127,7 @@ end
127
127
tspan = (0.0, 10.0)
128
128
p = [:p => 1.0, :d => 0.2]
129
129
oprob = ODEProblem(rn, u0, tspan, p)
130
-
sol = solve(oprob, Tsit5())
130
+
sol = solve(oprob)
131
131
plot(sol)
132
132
```
133
133
@@ -142,6 +142,7 @@ end
142
142
```
143
143
Please note that as the parameter `X₀` does not occur as part of any reactions, Catalyst's DSL cannot infer whether it is a species or a parameter. This must hence be explicitly declared. We can now simulate our model while providing `X`'s value through the `X₀` parameter:
144
144
```@example dsl_advanced_defaults
145
+
using OrdinaryDiffEqTsit5
145
146
u0 = []
146
147
p = [:X₀ => 1.0, :p => 1.0, :d => 0.5]
147
148
oprob = ODEProblem(rn, u0, tspan, p)
@@ -262,12 +263,12 @@ end
262
263
```
263
264
Now, we can also declare our initial conditions and parameter values as vectors as well:
The two-state model describes a component (here called $X$) which can exist in two different forms (here called $X₁$ and $X₂$). It switches between these forms at linear rates. First, we simulate the model using both ODEs and SDEs:
54
54
```@example crn_library_two_states
55
-
using Catalyst, OrdinaryDiffEqTsit5, StochasticDiffEq, Plots
55
+
using Catalyst, OrdinaryDiffEqDefault, StochasticDiffEq, Plots
plot(osol; title = "Reaction rate equation (ODE)", size=(800,350))
144
144
```
145
145
Next, we perform 3 different Jump simulations. Note that for the stochastic model, the occurrence of an outbreak is not certain. Rather, there is a possibility that it fizzles out without a noteworthy peak.
@@ -179,14 +179,14 @@ Below, we perform a simple deterministic ODE simulation of the system. Next, we
@@ -234,13 +234,13 @@ A simple example of such a loop is a transcription factor which activates its ow
234
234
235
235
We simulate the self-activation loop from a single initial condition using both deterministic (ODE) and stochastic (jump) simulations. We note that while the deterministic simulation reaches a single steady state, the stochastic one switches between two different states.
It is generally known to (for reaction rate equation-based ODE simulations) produce oscillations when $B > 1 + A^2$. However, this result is based on models generated when *combinatorial adjustment of rates is not performed*. Since Catalyst [automatically perform these adjustments](@ref introduction_to_catalyst_ratelaws), and one reaction contains a stoichiometric constant $>1$, the threshold will be different. Here, we trial two different values of $B$. In both cases, $B < 1 + A^2$, however, in the second case the system can generate oscillations.
269
269
```@example crn_library_brusselator
270
-
using OrdinaryDiffEqTsit5, Plots
270
+
using OrdinaryDiffEqDefault, Plots
271
271
u0 = [:X => 1.0, :Y => 1.0]
272
272
tspan = (0., 50.)
273
273
ps1 = [:A => 1.0, :B => 1.0]
274
274
ps2 = [:A => 1.0, :B => 1.8]
275
275
276
276
oprob1 = ODEProblem(brusselator, u0, tspan, ps1)
277
277
oprob2 = ODEProblem(brusselator, u0, tspan, ps2)
278
-
osol1 = solve(oprob1, Tsit5())
279
-
osol2 = solve(oprob2, Tsit5())
278
+
osol1 = solve(oprob1)
279
+
osol2 = solve(oprob2)
280
280
oplt1 = plot(osol1; title = "No Oscillation")
281
281
oplt2 = plot(osol2; title = "Oscillation")
282
282
@@ -296,16 +296,16 @@ end
296
296
```
297
297
Whether the Repressilator oscillates or not depends on its parameter values. Here, we will perform deterministic (ODE) simulations for two different values of $K$, showing that it oscillates for one value and not the other one. Next, we will perform stochastic (SDE) simulations for both $K$ values, showing that the stochastic model can sustain oscillations in both cases. This is an example of the phenomena of *noise-induced oscillation*.
298
298
```@example crn_library_brusselator
299
-
using OrdinaryDiffEqTsit5, StochasticDiffEq, Plots
299
+
using OrdinaryDiffEqDefault, StochasticDiffEq, Plots
oplt1 = plot(osol1; title = "Oscillation (ODE, K = 20)")
310
310
oplt2 = plot(osol2; title = "No oscillation (ODE, K = 50)")
311
311
@@ -337,12 +337,12 @@ end
337
337
```
338
338
Here we simulate the model for a single initial condition, showing both time-state space and phase space how it reaches a [*strange attractor*](https://www.dynamicmath.xyz/strange-attractors/).
0 commit comments