Skip to content

Commit f31b05f

Browse files
committed
fixes
1 parent ae8aace commit f31b05f

File tree

7 files changed

+22
-14
lines changed

7 files changed

+22
-14
lines changed

docs/src/catalyst_functionality/constraint_equations.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,12 @@ separate `ReactionSystem`s and `ODESystem`s with their respective components,
2525
and then extend the `ReactionSystem` with the `ODESystem`. Let's begin by
2626
creating these two systems.
2727

28-
Here, to create differentials with respect to time (for our differential equations), we must import the time differential operator from Catalyst. We do this through `import Catalyst: D_nounits as D` (calling it `D`). Here, `D(V)` denotes the differential of the variable `V` with respect to time.
28+
Here, to create differentials with respect to time (for our differential equations), we must import the time differential operator from Catalyst. We do this through `D = default_time_deriv()`. Here, `D(V)` denotes the differential of the variable `V` with respect to time.
2929

3030
```@example ceq1
3131
using Catalyst, DifferentialEquations, Plots
32-
t = default_t(), D_nounits as D
32+
t = default_t()
33+
D = default_time_deriv()
3334
3435
# set the growth rate to 1.0
3536
@parameters λ = 1.0
@@ -72,7 +73,8 @@ As an alternative to the previous approach, we could have constructed our
7273
`ReactionSystem` all at once by directly using the symbolic interface:
7374
```@example ceq2
7475
using Catalyst, DifferentialEquations, Plots
75-
t = default_t(), D_nounits as D
76+
t = default_t()
77+
D = default_time_deriv()
7678
7779
@parameters λ = 1.0
7880
@variables V(t) = 1.0
@@ -104,7 +106,8 @@ advanced_simulations) tutorial.
104106
Let's first create our equations and unknowns/species again
105107
```@example ceq3
106108
using Catalyst, DifferentialEquations, Plots
107-
t = default_t(), D_nounits as D
109+
t = default_t()
110+
D = default_time_deriv()
108111
109112
@parameters λ = 1.0
110113
@variables V(t) = 1.0

docs/src/catalyst_functionality/example_networks/hodgkin_huxley_equation.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ We begin by importing some necessary packages.
1515
using ModelingToolkit, Catalyst, NonlinearSolve
1616
using DifferentialEquations, Symbolics
1717
using Plots
18-
t = default_t(), D_nounits as D
18+
t = default_t()
19+
D = default_time_deriv()
1920
```
2021

2122
We'll build a simple Hodgkin-Huxley model for a single neuron, with the voltage,

docs/src/catalyst_functionality/network_analysis.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ the reaction rate equation ODE model for the repressilator is
5252
## Matrix-vector reaction rate equation representation
5353
In general, reaction rate equation (RRE) ODE models for chemical reaction networks can
5454
be represented as a first-order system of ODEs in a compact matrix-vector notation. Suppose
55-
we have a reaction network with ``K`` reactions and ``M`` species, labelled by the unknown vector
55+
we have a reaction network with ``K`` reactions and ``M`` species, labelled by the state vector
5656
```math
5757
\mathbf{x}(t) = \begin{pmatrix} x_1(t) \\ \vdots \\ x_M(t)) \end{pmatrix}.
5858
```
@@ -384,7 +384,7 @@ Recall that in the matrix-vector representation for the RRE ODEs, the entries,
384384
``N_{m k}``, of the stoichiometry matrix, ``N``, give the net change in species
385385
``m`` due to reaction ``k``. If we let ``\mathbf{N}_k`` denote the ``k``th
386386
column of this matrix, this vector corresponds to the change in the species
387-
unknown vector, ``\mathbf{x}(t)``, due to reaction ``k``, i.e. when reaction ``k``
387+
state vector, ``\mathbf{x}(t)``, due to reaction ``k``, i.e. when reaction ``k``
388388
occurs ``\mathbf{x}(t) \to \mathbf{x}(t) + \mathbf{N}_k``. Moreover, by
389389
integrating the ODE
390390
```math

docs/src/catalyst_functionality/programmatic_CRN_construction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ t = default_t()
2020
@species m₁(t) m₂(t) m₃(t) P₁(t) P₂(t) P₃(t)
2121
nothing # hide
2222
```
23-
Note: Each species is declared as a function of time. Here, we first import the *time independent variable using `t = default_t()`, and then use it to declare out species.
23+
Note: Each species is declared as a function of time. Here, we first import the *time independent variable*, and stores it in `t`, using `t = default_t()`, and then use it to declare out species.
2424

2525
!!! note
2626
For users familiar with ModelingToolkit, chemical species must be declared

src/Catalyst.jl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,15 @@ import DataStructures: OrderedDict, OrderedSet
4343
import Parameters: @with_kw_noshow
4444

4545
# globals for the modulate
46+
function default_time_deriv()
47+
return ModelingToolkit.D_nounits
48+
end
4649
function default_t()
4750
return ModelingToolkit.t_nounits
4851
end
4952
const DEFAULT_t = default_t()
5053
const DEFAULT_IV_SYM = Symbol(DEFAULT_t)
51-
export default_t
54+
export default_t, default_time_deriv
5255

5356
# as used in Catlab
5457
const USE_GV_JLL = Ref(false)

src/networkapi.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1403,7 +1403,7 @@ Notes:
14031403
- `disablechecks` will disable checking for whether the passed in variable is
14041404
already defined, which is useful when adding many new variables to the system.
14051405
*Do not disable checks* unless you are sure the passed in variable is a new
1406-
variable, as this will potentially leave the system in an undefined unknown.
1406+
variable, as this will potentially leave the system in an undefined state.
14071407
"""
14081408
function addspecies!(network::ReactionSystem, s::Symbolic; disablechecks = false)
14091409
reset_networkproperties!(network)
@@ -1435,7 +1435,7 @@ integer id of the species within the system.
14351435
- `disablechecks` will disable checking for whether the passed in variable is
14361436
already defined, which is useful when adding many new variables to the system.
14371437
*Do not disable checks* unless you are sure the passed in variable is a new
1438-
variable, as this will potentially leave the system in an undefined unknown.
1438+
variable, as this will potentially leave the system in an undefined state.
14391439
"""
14401440
function addspecies!(network::ReactionSystem, s::Num; disablechecks = false)
14411441
addspecies!(network, value(s), disablechecks = disablechecks)
@@ -1451,7 +1451,7 @@ id of the parameter within the system.
14511451
- `disablechecks` will disable checking for whether the passed in variable is
14521452
already defined, which is useful when adding many new variables to the system.
14531453
*Do not disable checks* unless you are sure the passed in variable is a new
1454-
variable, as this will potentially leave the system in an undefined unknown.
1454+
variable, as this will potentially leave the system in an undefined state.
14551455
"""
14561456
function addparam!(network::ReactionSystem, p::Symbolic; disablechecks = false)
14571457
reset_networkproperties!(network)
@@ -1480,7 +1480,7 @@ integer id of the parameter within the system.
14801480
- `disablechecks` will disable checking for whether the passed in variable is
14811481
already defined, which is useful when adding many new variables to the system.
14821482
*Do not disable checks* unless you are sure the passed in variable is a new
1483-
variable, as this will potentially leave the system in an undefined unknown.
1483+
variable, as this will potentially leave the system in an undefined state.
14841484
"""
14851485
function addparam!(network::ReactionSystem, p::Num; disablechecks = false)
14861486
addparam!(network, value(p); disablechecks = disablechecks)

test/miscellaneous_tests/events.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using Test, Catalyst, ModelingToolkit, OrdinaryDiffEq
2-
t = default_t(), D_nounits as D
2+
t = default_t()
3+
D = default_time_deriv()
34

45
# Test discrete event is propagated to ODE solver correctly.
56
let

0 commit comments

Comments
 (0)