Skip to content

Commit

Permalink
remove DifferentialEquations dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
TorkelE committed May 26, 2024
1 parent 37078d3 commit c372f5e
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 25 deletions.
2 changes: 2 additions & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ BifurcationKit = "0f109fa4-8a5d-4b75-95aa-f515264e7665"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
Catalyst = "479239e8-5488-4da2-87a7-35f2df7eef83"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
DiffEqParamEstim = "1130ab10-4a5a-5621-a13d-e4788d82bd4c"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DynamicalSystems = "61744808-ddfa-5f27-97ff-6e42cc95d634"
Expand Down Expand Up @@ -38,6 +39,7 @@ BifurcationKit = "0.3.3"
CairoMakie = "0.12"
Catalyst = "13"
DataFrames = "1.6"
DiffEqParamEstim = "2.2"
Distributions = "0.25"
Documenter = "1.4.1"
DynamicalSystems = "3.3"
Expand Down
6 changes: 3 additions & 3 deletions docs/pages.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pages = Any[
"Home" => "home.md",
#"Home" => "home.md",
"Introduction to Catalyst" => Any[
"introduction_to_catalyst/catalyst_for_new_julia_users.md",
# "introduction_to_catalyst/introduction_to_catalyst.md"
Expand Down Expand Up @@ -67,6 +67,6 @@ pages = Any[
# # Contributor's guide.
# # Repository structure.
# ],
"FAQs" => "faqs.md",
"API" => "api.md"
#"FAQs" => "faqs.md",
#"API" => "api.md"
]
25 changes: 8 additions & 17 deletions docs/src/assets/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ BifurcationKit = "0f109fa4-8a5d-4b75-95aa-f515264e7665"
CairoMakie = "13f3f980-e62b-5c42-98c6-ff1f3baf88f0"
Catalyst = "479239e8-5488-4da2-87a7-35f2df7eef83"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
DiffEqParamEstim = "1130ab10-4a5a-5621-a13d-e4788d82bd4c"
DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa"
Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
DynamicalSystems = "61744808-ddfa-5f27-97ff-6e42cc95d634"
Expand All @@ -15,21 +13,18 @@ IncompleteLU = "40713840-3770-5561-ab4c-a76e7d0d7895"
JumpProcesses = "ccbc3e58-028d-4f4c-8cd5-9ae44345cda5"
Latexify = "23fbe1c1-3f47-55db-b15f-69d7ec21a316"
LinearSolve = "7ed4a6bd-45f5-4d41-b270-4a48e9bafcae"
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78"
NonlinearSolve = "8913a72c-1f9b-4ce2-8d82-65094dcecaec"
Optim = "429524aa-4258-5aef-a3af-852621145aeb"
Optimization = "7f7a1694-90dd-40f0-9382-eb1efda571ba"
OptimizationBBO = "3e6eede4-6085-4f62-9a71-46d9bc1eb92b"
OptimizationNLopt = "4e6fcdb7-1186-4e1f-a706-475e75c168bb"
OptimizationOptimJL = "36348300-93cb-4f02-beb5-3c3902f8871e"
OptimizationOptimisers = "42dfb2eb-d2b4-4451-abcd-913932933ac1"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80"
QuasiMonteCarlo = "8a4e6c94-4038-4cdc-81c3-7e6ffdb2a71b"
SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462"
SciMLSensitivity = "1ed8b502-d754-442c-8d5d-10ac956f44a1"
Setfield = "efcf1570-3423-57d1-acb7-fd33fddbac46"
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
SteadyStateDiffEq = "9672c7b4-1e72-59bd-8a11-6ac3964bc41f"
Expand All @@ -39,38 +34,34 @@ Symbolics = "0c5d862f-8b57-4792-8d23-62f2024744c7"

[compat]
BenchmarkTools = "1.5.0"
BifurcationKit = "0.3"
BifurcationKit = "0.3.3"
CairoMakie = "0.12"
Catalyst = "13"
DataFrames = "1.6"
DiffEqParamEstim = "2.2"
DifferentialEquations = "7.13"
Distributions = "0.25"
DynamicalSystems = "3.3"
Documenter = "1.4.1"
DynamicalSystems = "3.3"
GlobalSensitivity = "2.6"
HomotopyContinuation = "2.9"
IncompleteLU = "0.2"
JumpProcesses = "9.11"
Latexify = "0.16"
LinearSolve = "2.30"
ModelingToolkit = "9.15"
NonlinearSolve = "3.11"
NonlinearSolve = "3.12"
Optim = "1.9"
Optimization = "3.24"
Optimization = "3.25"
OptimizationBBO = "0.2"
OptimizationNLopt = "0.2"
OptimizationOptimJL = "0.3"
OptimizationOptimisers = "0.2"
OrdinaryDiffEq = "6.80"
Plots = "1.40"
QuasiMonteCarlo = "0.3"
SciMLBase = "2.38"
SciMLSensitivity = "7.56"
Setfield = "1.1"
SciMLBase = "2.39"
SciMLSensitivity = "7.59"
SpecialFunctions = "2.4"
StaticArrays = "1.9"
SteadyStateDiffEq = "2.2"
StochasticDiffEq = "6.65"
StructuralIdentifiability = "0.5"
Symbolics = "5.28"
StructuralIdentifiability = "0.5.7"
Symbolics = "5.28"
15 changes: 10 additions & 5 deletions docs/src/introduction_to_catalyst/catalyst_for_new_julia_users.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,15 @@ To import a Julia package into a session, you can use the `using PackageName` co
using Pkg
Pkg.add("Catalyst")
```
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 `DifferentialEquations` and `Plots` packages (for numeric simulation of models, and plotting, respectively).
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 `OrdinaryDiffEq` and `Plots` packages (for numeric simulation of models, and plotting, respectively).
```julia
Pkg.add("DifferentialEquations")
Pkg.add("OrdinaryDiffEq")
Pkg.add("Plots")
```
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:
```@example ex2
using Catalyst
using DifferentialEquations
using OrdinaryDiffEq
using Plots
```
Here, if we restart Julia, these `using` commands *must be rerun*.
Expand Down Expand Up @@ -130,7 +130,11 @@ For more information about the numerical simulation package, please see the [Dif
## Additional modelling example
To make this introduction more comprehensive, we here provide another example, using a more complicated model. Instead of simulating our model as concentrations evolve over time, we will now simulate the individual reaction events through the [Gillespie algorithm](https://en.wikipedia.org/wiki/Gillespie_algorithm) (a common approach for adding *noise* to models).

Remember (unless we have restarted Julia) we do not need to activate our packages (through the `using` command) again.
Remember (unless we have restarted Julia) we do not need to activate our packages (through the `using` command) again. However, we do need to install, and then import, the JumpProcesses package (just to perform Gillespie, and other jump, simulations)
```julia
Pkg.add("JumpProcesses")
using JumpProcesses
```

This time, we will declare a so-called [SIR model for an infectious disease](https://en.wikipedia.org/wiki/Compartmental_models_in_epidemiology#The_SIR_model). Note that even if this model does not describe a set of chemical reactions, it can be modelled using the same framework. The model consists of 3 species:
* $S$, the amount of *susceptible* individuals.
Expand Down Expand Up @@ -164,12 +168,13 @@ nothing # hide

Previously we have bundled this information into an `ODEProblem` (denoting a deterministic *ordinary differential equation*). Now we wish to simulate our model as a jump process (where each reaction event corresponds to a single jump in the state of the system). We do this by first creating a `DiscreteProblem`, and then using this as an input to a `JumpProblem`.
```@example ex2
using JumpProcesses # hide
dprob = DiscreteProblem(sir_model, u0, tspan, params)
jprob = JumpProblem(sir_model, dprob, Direct())
```
Again, the order in which the inputs are given to the `DiscreteProblem` and the `JumpProblem` is important. The last argument to the `JumpProblem` (`Direct()`) denotes which simulation method we wish to use. For now, we recommend that users simply use the `Direct()` option, and then consider alternative ones (see the [JumpProcesses.jl docs](https://docs.sciml.ai/JumpProcesses/stable/)) when they are more familiar with modelling in Catalyst and Julia.

Finally, we can simulate our model using the `solve` function, and plot the solution using the `plot` function. Here, the `solve` function also has a second argument (`SSAStepper()`). This is a time-stepping algorithm that calls the `Direct` solver to advance a simulation. Again, we recommend at this stage you simply use this option, and then explore exactly what this means at a later stage.
Finally, we can simulate our model using the `solve` function, and plot the solution using the `plot` function. For jump simulations, the `solve` function also requires a second argument (`SSAStepper()`). This is a time-stepping algorithm that calls the `Direct` solver to advance a simulation. Again, we recommend at this stage you simply use this option, and then explore exactly what this means at a later stage.
```@example ex2
sol = solve(jprob, SSAStepper())
sol = solve(jprob, SSAStepper(); seed=1234) # hide
Expand Down

0 comments on commit c372f5e

Please sign in to comment.