Skip to content

Commit 5c01feb

Browse files
committed
new @register_symbolic example
1 parent fe3ffb8 commit 5c01feb

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

docs/src/model_creation/dsl_basics.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -265,12 +265,12 @@ Catalyst comes with the following predefined functions:
265265
- The activating/repressive Hill function: $hillar(X,Y,v,K,n) = v * (X^n)/(X^n + Y^n + K^n)$.
266266

267267
### [Registration of non-algebraic functions](@id dsl_description_nonconstant_rates_function_registration)
268-
Previously we showed how user-defined functions [can be used in rates directly](@ref dsl_description_nonconstant_rates_available_functions). For functions containing more complicated syntax (e.g. `for` loops or `if` statements), we must add an additional step: registering it using the `@register_symbolic` macro. Below we define a function which output depends on whether `X` is smaller or larger than a threshold value. Next, we register it using `@register_symbolic`, after which we can use it within the DSL.
268+
Previously we showed how user-defined functions [can be used in rates directly](@ref dsl_description_nonconstant_rates_available_functions). For functions containing more complicated syntax (e.g. `for` loops or `if` statements), we must add an additional step: registering it using the `@register_symbolic` macro. Below we define a non-standard function of one variable. Next, we register it using `@register_symbolic`, after which we can use it within the DSL.
269269
```@example dsl_basics
270-
thresfunc(X) = (X < 10) ? X : 10.0
271-
@register_symbolic thresfunc(X)
270+
weirdfunc(x) = round(x) + 2.0
271+
@register_symbolic weirdfunc(X)
272272
rn = @reaction_network begin
273-
thresfunc(X), 0 --> X
273+
weirdfunc(X), 0 --> X
274274
d, X --> 0
275275
end
276276
```

0 commit comments

Comments
 (0)