Skip to content

Commit 22041fa

Browse files
committed
misc minor doc/test fixes
1 parent 1b6efc5 commit 22041fa

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

docs/src/model_creation/functional_parameters.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ plot(sol)
3333
For this simple example, $(2 + t)/(1 + t)$ could have been used directly as a reaction rate, technically making the functional parameter approach unnecessary.
3434

3535
## [Inserting a customised, time-dependent, input](@id functional_parameters_circ_rhythm)
36-
Let us now go through everything again, but providing some more details. Let us first consider the input parameter. We have previously described how a [time-dependent rate can model a circadian rhythm](@ef dsl_description_nonconstant_rates_time). For real applications, due to e.g. clouds, sunlight is not a perfect sine wave. Here, a common solution is to take real sunlight data from some location and use in the model. Here, we will create synthetic (noisy) data as our light input:
36+
Let us now go through everything again, but providing some more details. Let us first consider the input parameter. We have previously described how a [time-dependent rate can model a circadian rhythm](@ref dsl_description_nonconstant_rates_time). For real applications, due to e.g. clouds, sunlight is not a perfect sine wave. Here, a common solution is to take real sunlight data from some location and use in the model. Here, we will create synthetic (noisy) data as our light input:
3737
```@example functional_parameters_circ_rhythm
3838
using Plots
3939
tend = 120.0
@@ -75,9 +75,9 @@ plot(sol)
7575
### [Interpolating the input into the DSL](@id functional_parameters_circ_rhythm_dsl)
7676
It is possible to use time-dependent inputs when creating models [through the DSL](@ref dsl_description) as well. However, it can still be convenient to declare the input parameter programmatically as above. Next, we form an expression of it as a function of time, and then [interpolate](@ref dsl_advanced_options_symbolics_and_DSL_interpolation) it into our DSL-declaration:
7777
```@example functional_parameters_circ_rhythm
78-
input = pIn(t)
78+
input = light_in(t)
7979
rs_dsl = @reaction_network rs begin
80-
(kA*$input, kI), Pᵢ <--> Pₐ
80+
(kA*$input, kD), Pᵢ <--> Pₐ
8181
end
8282
```
8383
We can confirm that this model is identical to our programmatic one (and should we wish to, we can simulate it using identical syntax syntax).
@@ -87,15 +87,15 @@ rs == rs_dsl
8787

8888
## [Non-time functional parameters](@id functional_parameters_sir)
8989
Previously we have demonstrated functional parameters that are a function of time. However, functional parameters can be functions of any variable (however, currently, more than one argument is not supported). Here we will demonstrate this using a [SIR model](@ref basic_CRN_library_sir), but instead of having the infection rate scale linearly with the number of infected individuals, we instead assume we have measured data of the infection rate (as dependent on the number of infected individuals) and wish to use this instead. Normally we use the following infection reaction in the SIR model:
90-
```@example julia
90+
```julia
9191
@reaction k1, S + I --> 2I
9292
```
9393
In practise, this is identical to
94-
```@example julia
94+
```julia
9595
@reaction k1*I, S --> I
9696
```
9797
Due to performance reasons (especially for jump simulations) the former approach is *strongly* encouraged. Here, however, we will assume that we have measured real data of how the number of infected individuals affects the infection rate, and wish to use this in our model, i.e. something like this:
98-
```@example julia
98+
```julia
9999
@reaction k1*i_rate(I), S --> I
100100
```
101101
This is a case where we can use a functional parameter, whose value depends on the value of $I$.

test/reactionsystem_core/functional_parameters.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11

22
# Fetch packages.
3-
using Catalyst, DataInterpolations, JumpProcesses, OrdinaryDiffEqDefault, StochasticDiffEq, Test
3+
using Catalyst, DataInterpolations, DynamicQuantities, JumpProcesses, OrdinaryDiffEqDefault, StochasticDiffEq, Test
44

55
# Sets the default `t` to use.
66
t = default_t()

0 commit comments

Comments
 (0)