diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f506c82a..198b4fd9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,13 +12,13 @@ concurrency: cancel-in-progress: true env: - NBCONVERT_JOBS: '3' - LITERATE_PROC: '3' + NBCONVERT_JOBS: '2' + LITERATE_PROC: '2' + JULIA_NUM_THREADS: '2' ALLOWERRORS: 'false' JULIA_CONDAPKG_BACKEND: 'Null' JULIA_CI: 'true' NBCACHE: '.cache' - UV_SYSTEM_PYTHON: 1 jobs: CI: @@ -34,13 +34,10 @@ jobs: - name: Install Python dependencies run: | pip install uv - uv pip install -r requirements.txt + uv pip install --system -r requirements.txt - name: Read Julia version - uses: SebRollen/toml-action@v1.2.0 id: read_toml - with: - file: 'Manifest.toml' - field: 'julia_version' + run: echo value=$(python -c 'import tomllib; from pathlib import Path; print(tomllib.loads(Path("Manifest.toml").read_text())["julia_version"])') >> "$GITHUB_OUTPUT" - name: Get environment hash id: hash run: | diff --git a/.github/workflows/linkcheck.yml b/.github/workflows/linkcheck.yml index 4931b045..32dec142 100644 --- a/.github/workflows/linkcheck.yml +++ b/.github/workflows/linkcheck.yml @@ -19,7 +19,6 @@ jobs: linkcheck: env: DIR: 'docs' - UV_SYSTEM_PYTHON: 1 runs-on: ubuntu-latest steps: - name: Checkout @@ -46,9 +45,9 @@ jobs: id: setup-python with: python-version: '3.x' - - name: Install uv - run: curl -LsSf https://astral.sh/uv/install.sh | sh - name: Install Python dependencies - run: uv pip install -r requirements.txt + run: | + pip install uv + uv pip install --system -r requirements.txt - name: Build website run: jupyter-book build ${DIR} --builder linkcheck diff --git a/Manifest.toml b/Manifest.toml index ea3bc6d2..a6173ef1 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -2,7 +2,7 @@ julia_version = "1.11.1" manifest_format = "2.0" -project_hash = "7e5807e059f83e7dc9033cceb2df5b3a68479e06" +project_hash = "a5120a3c8f5dc351457c968d8af338aebf0e50c7" [[deps.ADTypes]] git-tree-sha1 = "eea5d80188827b35333801ef97a40c2ed653b081" @@ -120,16 +120,6 @@ git-tree-sha1 = "01b8ccb13d68535d73d2b0c23e39bd23155fb712" uuid = "13072b0f-2c55-5437-9ae7-d433b7a33950" version = "1.1.0" -[[deps.BandedMatrices]] -deps = ["ArrayLayouts", "FillArrays", "LinearAlgebra", "PrecompileTools"] -git-tree-sha1 = "a2c85f53ddcb15b4099da59867868bd40f005579" -uuid = "aae01518-5342-5314-be14-df237901396f" -version = "1.7.5" -weakdeps = ["SparseArrays"] - - [deps.BandedMatrices.extensions] - BandedMatricesSparseArraysExt = "SparseArrays" - [[deps.Base64]] uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" version = "1.11.0" @@ -155,22 +145,12 @@ deps = ["ArrayLayouts", "FillArrays", "LinearAlgebra"] git-tree-sha1 = "d434647f798823bcae510aee0bc0401927f64391" uuid = "8e7c35d0-a365-5155-bbbb-fb81a777f24e" version = "1.1.1" -weakdeps = ["BandedMatrices"] [deps.BlockArrays.extensions] BlockArraysBandedMatricesExt = "BandedMatrices" -[[deps.BoundaryValueDiffEq]] -deps = ["ADTypes", "Adapt", "ArrayInterface", "BandedMatrices", "ConcreteStructs", "DiffEqBase", "FastAlmostBandedMatrices", "FastClosures", "ForwardDiff", "LineSearch", "LineSearches", "LinearAlgebra", "LinearSolve", "Logging", "NonlinearSolve", "OrdinaryDiffEq", "PreallocationTools", "PrecompileTools", "Preferences", "RecursiveArrayTools", "Reexport", "SciMLBase", "Setfield", "SparseArrays", "SparseDiffTools"] -git-tree-sha1 = "8dba4ea86fce8ed94977ed9e56cf5c6d67c494e5" -uuid = "764a87c0-6b3e-53db-9096-fe964310641d" -version = "5.11.0" - - [deps.BoundaryValueDiffEq.extensions] - BoundaryValueDiffEqODEInterfaceExt = "ODEInterface" - - [deps.BoundaryValueDiffEq.weakdeps] - ODEInterface = "54ca160b-1b9f-5127-a996-1867f4bc2a2c" + [deps.BlockArrays.weakdeps] + BandedMatrices = "aae01518-5342-5314-be14-df237901396f" [[deps.Bzip2_jll]] deps = ["Artifacts", "JLLWrappers", "Libdl", "Pkg"] @@ -178,11 +158,6 @@ git-tree-sha1 = "9e2a6b69137e6969bab0152632dcb3bc108c8bdd" uuid = "6e34b625-4abd-537c-b88f-471c36dfa7a0" version = "1.0.8+1" -[[deps.CEnum]] -git-tree-sha1 = "389ad5c84de1ae7cf0e28e381131c98ea87d54fc" -uuid = "fa961155-64e5-5f13-b03f-caf6b980ea82" -version = "0.5.0" - [[deps.CPUSummary]] deps = ["CpuId", "IfElse", "PrecompileTools", "Static"] git-tree-sha1 = "5a97e67919535d6841172016c9530fd69494e5ec" @@ -404,12 +379,6 @@ git-tree-sha1 = "fc173b380865f70627d7dd1190dc2fce6cc105af" uuid = "ee1fde0b-3d02-5ea6-8484-8dfef6360eab" version = "1.14.10+0" -[[deps.DelayDiffEq]] -deps = ["ArrayInterface", "DataStructures", "DiffEqBase", "LinearAlgebra", "Logging", "OrdinaryDiffEq", "Printf", "RecursiveArrayTools", "Reexport", "SciMLBase", "SimpleNonlinearSolve", "SimpleUnPack"] -git-tree-sha1 = "066f60231c1b0ae2905ffd2651e207accd91f627" -uuid = "bcd4f6db-9728-5f36-b5f7-82caef46ccdb" -version = "5.48.1" - [[deps.DelimitedFiles]] deps = ["Mmap"] git-tree-sha1 = "9e2f36d3c96a820c678f2f1f1782582fcf685bae" @@ -451,11 +420,10 @@ version = "6.158.1" Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" [[deps.DiffEqCallbacks]] -deps = ["DataStructures", "DiffEqBase", "ForwardDiff", "Functors", "LinearAlgebra", "Markdown", "NonlinearSolve", "Parameters", "RecipesBase", "RecursiveArrayTools", "SciMLBase", "StaticArraysCore"] -git-tree-sha1 = "19dbd44d18bbfdfcf5e56c99cea9b0ed23df350a" +deps = ["ConcreteStructs", "DataStructures", "DiffEqBase", "DifferentiationInterface", "Functors", "LinearAlgebra", "Markdown", "RecipesBase", "RecursiveArrayTools", "SciMLBase", "StaticArraysCore"] +git-tree-sha1 = "7f700fa4fb6e55f4672f8218ef228107245a2e9d" uuid = "459566f4-90b8-5000-8ac3-15dfb0a30def" -version = "3.9.1" -weakdeps = ["OrdinaryDiffEq", "OrdinaryDiffEqCore", "Sundials"] +version = "4.0.0" [[deps.DiffEqNoiseProcess]] deps = ["DiffEqBase", "Distributions", "GPUArraysCore", "LinearAlgebra", "Markdown", "Optim", "PoissonRandom", "QuadGK", "Random", "Random123", "RandomNumbers", "RecipesBase", "RecursiveArrayTools", "ResettableStacks", "SciMLBase", "StaticArraysCore", "Statistics"] @@ -481,12 +449,6 @@ git-tree-sha1 = "23163d55f885173722d1e4cf0f6110cdbaf7e272" uuid = "b552c78f-8df3-52c6-915a-8e097449b14b" version = "1.15.1" -[[deps.DifferentialEquations]] -deps = ["BoundaryValueDiffEq", "DelayDiffEq", "DiffEqBase", "DiffEqCallbacks", "DiffEqNoiseProcess", "JumpProcesses", "LinearAlgebra", "LinearSolve", "NonlinearSolve", "OrdinaryDiffEq", "Random", "RecursiveArrayTools", "Reexport", "SciMLBase", "SteadyStateDiffEq", "StochasticDiffEq", "Sundials"] -git-tree-sha1 = "d851f2ca05f3cec9988f081b047a778a58b48aaf" -uuid = "0c46a032-eb83-5123-abaf-570d42b7fbaa" -version = "7.14.0" - [[deps.DifferentiationInterface]] deps = ["ADTypes", "LinearAlgebra"] git-tree-sha1 = "16611777adf4a818f18c33210895947814180964" @@ -540,17 +502,6 @@ weakdeps = ["ChainRulesCore", "EnzymeCore"] DispatchDoctorChainRulesCoreExt = "ChainRulesCore" DispatchDoctorEnzymeCoreExt = "EnzymeCore" -[[deps.Distances]] -deps = ["LinearAlgebra", "Statistics", "StatsAPI"] -git-tree-sha1 = "66c4c81f259586e8f002eacebc177e1fb06363b0" -uuid = "b4f34e82-e78d-54a5-968a-f98e89d6e8f7" -version = "0.10.11" -weakdeps = ["ChainRulesCore", "SparseArrays"] - - [deps.Distances.extensions] - DistancesChainRulesCoreExt = "ChainRulesCore" - DistancesSparseArraysExt = "SparseArrays" - [[deps.Distributed]] deps = ["Random", "Serialization", "Sockets"] uuid = "8ba89e20-285c-5b6f-9357-94700520ee1b" @@ -680,12 +631,6 @@ git-tree-sha1 = "466d45dc38e15794ec7d5d63ec03d776a9aff36e" uuid = "b22a6f82-2f65-5046-a5b2-351ab43fb4e5" version = "4.4.4+1" -[[deps.FastAlmostBandedMatrices]] -deps = ["ArrayInterface", "ArrayLayouts", "BandedMatrices", "ConcreteStructs", "LazyArrays", "LinearAlgebra", "MatrixFactorizations", "PrecompileTools", "Reexport"] -git-tree-sha1 = "3f03d94c71126b6cfe20d3cbcc41c5cd27e1c419" -uuid = "9d29842c-ecb8-4973-b1e9-a27b1157504e" -version = "0.1.4" - [[deps.FastBroadcast]] deps = ["ArrayInterface", "LinearAlgebra", "Polyester", "Static", "StaticArrayInterface", "StrideArraysCore"] git-tree-sha1 = "ab1b34570bcdf272899062e1a56285a53ecaae08" @@ -1110,12 +1055,6 @@ deps = ["Artifacts", "Pkg"] uuid = "4af54fe1-eca0-43a8-85a7-787d91b784e3" version = "1.11.0" -[[deps.LevyArea]] -deps = ["LinearAlgebra", "Random", "SpecialFunctions"] -git-tree-sha1 = "56513a09b8e0ae6485f34401ea9e2f31357958ec" -uuid = "2d8b4e74-eb68-11e8-0fb9-d5eb67b50637" -version = "1.0.0" - [[deps.LibCURL]] deps = ["LibCURL_jll", "MozillaCACerts_jll"] uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" @@ -1314,16 +1253,6 @@ deps = ["Base64"] uuid = "d6f4376e-aef5-505a-96c1-9c027394607a" version = "1.11.0" -[[deps.MatrixFactorizations]] -deps = ["ArrayLayouts", "LinearAlgebra", "Printf", "Random"] -git-tree-sha1 = "16a726dba99685d9e94c8d0a8f655383121fc608" -uuid = "a3b82374-2e81-5b9e-98ce-41277c0e4c87" -version = "3.0.1" -weakdeps = ["BandedMatrices"] - - [deps.MatrixFactorizations.extensions] - MatrixFactorizationsBandedMatricesExt = "BandedMatrices" - [[deps.MaybeInplace]] deps = ["ArrayInterface", "LinearAlgebra", "MacroTools"] git-tree-sha1 = "54e2fdc38130c05b42be423e90da3bade29b74bd" @@ -1405,12 +1334,6 @@ git-tree-sha1 = "a0b464d183da839699f4c79e7606d9d186ec172c" uuid = "d41bc354-129a-5804-8e4c-c37616107c6c" version = "7.8.3" -[[deps.NLsolve]] -deps = ["Distances", "LineSearches", "LinearAlgebra", "NLSolversBase", "Printf", "Reexport"] -git-tree-sha1 = "019f12e9a1a7880459d0173c182e6a99365d7ac1" -uuid = "2774e3e8-f4cf-5e23-947b-6d7e65073b56" -version = "4.5.1" - [[deps.NaNMath]] deps = ["OpenLibm_jll"] git-tree-sha1 = "0877504529a3e5c3343c6f8b4c0381e57e4387e4" @@ -2310,12 +2233,6 @@ git-tree-sha1 = "920acf6ae36c86f23969fea1d317e040dbfccf53" uuid = "9672c7b4-1e72-59bd-8a11-6ac3964bc41f" version = "2.4.1" -[[deps.StochasticDiffEq]] -deps = ["Adapt", "ArrayInterface", "DataStructures", "DiffEqBase", "DiffEqNoiseProcess", "DocStringExtensions", "FiniteDiff", "ForwardDiff", "JumpProcesses", "LevyArea", "LinearAlgebra", "Logging", "MuladdMacro", "NLsolve", "OrdinaryDiffEq", "Random", "RandomNumbers", "RecursiveArrayTools", "Reexport", "SciMLBase", "SciMLOperators", "SparseArrays", "SparseDiffTools", "StaticArrays", "UnPack"] -git-tree-sha1 = "b49030a24847e8c3e85eed3359825297ffb70dfa" -uuid = "789caeaf-c7a9-5a7d-9973-96adeb23e2a0" -version = "6.69.1" - [[deps.StrideArraysCore]] deps = ["ArrayInterface", "CloseOpenIntervals", "IfElse", "LayoutPointers", "LinearAlgebra", "ManualMemory", "SIMDTypes", "Static", "StaticArrayInterface", "ThreadingUtilities"] git-tree-sha1 = "f35f6ab602df8413a50c4a25ca14de821e8605fb" @@ -2341,18 +2258,6 @@ deps = ["Artifacts", "Libdl", "libblastrampoline_jll"] uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c" version = "7.7.0+0" -[[deps.Sundials]] -deps = ["CEnum", "DataStructures", "DiffEqBase", "Libdl", "LinearAlgebra", "Logging", "PrecompileTools", "Reexport", "SciMLBase", "SparseArrays", "Sundials_jll"] -git-tree-sha1 = "e87efb31e5360cb223a151c2398903dc2faeb32b" -uuid = "c3572dad-4567-51f8-b174-8c6c989267f4" -version = "4.26.0" - -[[deps.Sundials_jll]] -deps = ["Artifacts", "CompilerSupportLibraries_jll", "JLLWrappers", "Libdl", "SuiteSparse_jll", "libblastrampoline_jll"] -git-tree-sha1 = "91db7ed92c66f81435fe880947171f1212936b14" -uuid = "fb77eaff-e24c-56d4-86b1-d163f2edb164" -version = "5.2.3+0" - [[deps.SymbolicIndexingInterface]] deps = ["Accessors", "ArrayInterface", "RuntimeGeneratedFunctions", "StaticArraysCore"] git-tree-sha1 = "4bc96df5d71515b1cb86dd626915f06f4c0d46f5" diff --git a/Project.toml b/Project.toml index bf116879..ad7c9bbe 100644 --- a/Project.toml +++ b/Project.toml @@ -2,21 +2,16 @@ CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b" Catalyst = "479239e8-5488-4da2-87a7-35f2df7eef83" DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0" -DifferentialEquations = "0c46a032-eb83-5123-abaf-570d42b7fbaa" +DiffEqCallbacks = "459566f4-90b8-5000-8ac3-15dfb0a30def" Distributions = "31c24e10-a181-5473-b8eb-7969acd0382f" ForwardDiff = "f6369f11-7733-5829-9624-2563aa707210" Interpolations = "a98d9a8b-a2ab-59e6-89dd-64a1c18fca59" +JumpProcesses = "ccbc3e58-028d-4f4c-8cd5-9ae44345cda5" ModelingToolkit = "961ee093-0014-501f-94e3-6117800e7a78" +OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c" SimpleUnPack = "ce78b400-467f-4804-87d8-8f486da07d0a" Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2" StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" - -[preferences.BoundaryValueDiffEq] -PrecompileMIRK = false -PrecompileMIRKNLLS = false -PrecompileMultipleShooting = false -PrecompileMultipleShootingNLLS = false -PrecompileShooting = false -PrecompileShootingNLLS = false +SteadyStateDiffEq = "9672c7b4-1e72-59bd-8a11-6ac3964bc41f" diff --git a/docs/figs/ch1-07.jl b/docs/figs/ch1-07.jl index 692c149d..cada68dd 100644 --- a/docs/figs/ch1-07.jl +++ b/docs/figs/ch1-07.jl @@ -5,8 +5,7 @@ Collins toggle switch For Figures 1.7, 7.13, 7.14, 7.15 ===# - -using DifferentialEquations +using OrdinaryDiffEq using ModelingToolkit using Plots Plots.default(linewidth=2) @@ -25,8 +24,8 @@ function build_collins(;name) γ=4.0 end + @independent_variables t @variables begin - t s1(t)=0.075 s2(t)=2.5 i1(t) @@ -41,12 +40,11 @@ function build_collins(;name) i2 ~ 10 * (10 < t) * (t < 20), i1 ~ 10 * (30 < t) * (t < 40), ] - sys = ODESystem(eqs, t; name) - return structural_simplify(sys) + return ODESystem(eqs, t; name) end #--- -@named sys = build_collins() +@mtkbuild sys = build_collins() # Solve the problem tspan = (0.0, 50.0) diff --git a/docs/figs/ch1-09.jl b/docs/figs/ch1-09.jl index 957c2c43..5482e410 100644 --- a/docs/figs/ch1-09.jl +++ b/docs/figs/ch1-09.jl @@ -4,8 +4,7 @@ Hodgkin-Huxley model ===# - -using DifferentialEquations +using OrdinaryDiffEq using ModelingToolkit using Plots Plots.default(linewidth=2) @@ -27,8 +26,9 @@ function build_hh(;name) C_M = 1.0 ## membrane capacitance (uF/cm^2)) end + @independent_variables t + @variables begin - t mα(t) mβ(t) hα(t) @@ -64,13 +64,12 @@ function build_hh(;name) D(n) ~ -(nα + nβ) * n + nα, ] - sys = ODESystem(eqs, t; name) - return structural_simplify(sys) + return ODESystem(eqs, t; name) end #--- tend = 100.0 -@named sys = build_hh() +@mtkbuild sys = build_hh() prob = ODEProblem(sys, [], tend, []) #--- diff --git a/docs/figs/ch2-09.jl b/docs/figs/ch2-09.jl index c4c5a9db..e9a2ef04 100644 --- a/docs/figs/ch2-09.jl +++ b/docs/figs/ch2-09.jl @@ -5,7 +5,7 @@ Metabolic network simulation Using `Catalyst.jl` to simulate a metabolic network. ===# -using DifferentialEquations +using OrdinaryDiffEq using Catalyst using ModelingToolkit using Plots diff --git a/docs/figs/ch2-11.jl b/docs/figs/ch2-11.jl index 604dcebf..6a19744b 100644 --- a/docs/figs/ch2-11.jl +++ b/docs/figs/ch2-11.jl @@ -3,7 +3,7 @@ Model reduction of ODE metabolic networks. ===# -using DifferentialEquations +using OrdinaryDiffEq using Catalyst using ModelingToolkit using Plots @@ -36,7 +36,7 @@ plot( function make_212(;name) @parameters k0 k1 km1 k2 - @variables t + @independent_variables t @variables A(t) B(t) C(t) D = Differential(t) eqs = [ @@ -44,12 +44,11 @@ function make_212(;name) B ~ C * k1 / (km1 + k1) D(C) ~ k0 - k2 * B ] - sys = ODESystem(eqs, t; name) - structural_simplify(sys) + return ODESystem(eqs, t; name) end #--- -@named model212 = make_212() +@mtkbuild model212 = make_212() #--- unknowns(model212) @@ -113,20 +112,18 @@ Quasi-steady state assumption on species A function make_214(;name) @parameters k0 k1 km1 k2 - @variables t + @independent_variables t @variables A(t) B(t) D = Differential(t) eqs = [ A ~ (k0 + km1 * B)/k1 D(B) ~ k1 * A - (km1 + k2) * B ] - sys = ODESystem(eqs, t; name) - structural_simplify(sys) + return ODESystem(eqs, t; name) end #--- - -@named model214 = make_214() +@mtkbuild model214 = make_214() # Initial conditions can also be represented in symbols sol214 = solve(ODEProblem(model214, [B => (k1 * sum(last.(u0)) - k0) / (k1 + km1)], tend, ps2)) diff --git a/docs/figs/ch2-p246.jl b/docs/figs/ch2-p246.jl index bdab7f82..52d7101e 100644 --- a/docs/figs/ch2-p246.jl +++ b/docs/figs/ch2-p246.jl @@ -1,5 +1,5 @@ # # Prob 2.4.6 -using DifferentialEquations +using OrdinaryDiffEq using Plots Plots.default(linewidth=2) diff --git a/docs/figs/ch3-03.jl b/docs/figs/ch3-03.jl index fb4bfe71..ea7165d5 100644 --- a/docs/figs/ch3-03.jl +++ b/docs/figs/ch3-03.jl @@ -3,12 +3,13 @@ Michaelis-Menten kinetics ===# -using DifferentialEquations +using OrdinaryDiffEq +using ModelingToolkit using Catalyst using Plots Plots.default(linewidth=2) -# Reaction neetwork +# Reaction network rn = @reaction_network begin (k1, km1), S + E <--> ES k2, ES --> E + P diff --git a/docs/figs/ch4-01.jl b/docs/figs/ch4-01.jl index 6f4962e8..14f11b5a 100644 --- a/docs/figs/ch4-01.jl +++ b/docs/figs/ch4-01.jl @@ -3,7 +3,7 @@ Steady states and phase plots in an asymmetric network. ===# -using DifferentialEquations +using OrdinaryDiffEq using SimpleUnPack using Plots Plots.default(linewidth=2) diff --git a/docs/figs/ch4-07.jl b/docs/figs/ch4-07.jl index 924c19a5..78783e80 100644 --- a/docs/figs/ch4-07.jl +++ b/docs/figs/ch4-07.jl @@ -1,7 +1,6 @@ # # Fig 4.7, 4.8 # Symmetric (bistable) biological networks. - -using DifferentialEquations +using OrdinaryDiffEq using Plots Plots.default(linewidth=2) diff --git a/docs/figs/ch4-11.jl b/docs/figs/ch4-11.jl index 44104134..372a8f13 100644 --- a/docs/figs/ch4-11.jl +++ b/docs/figs/ch4-11.jl @@ -3,7 +3,6 @@ Surface plots reference: [surface plots @ PlotsGallery.jl](https://goropikari.github.io/PlotsGallery.jl/src/surface.html) ===# - using Plots Plots.default(linewidth=2) diff --git a/docs/figs/ch4-15.jl b/docs/figs/ch4-15.jl index cea142bf..1d8d1daa 100644 --- a/docs/figs/ch4-15.jl +++ b/docs/figs/ch4-15.jl @@ -1,8 +1,7 @@ # # Fig 4.15, 4.16, 4.17 # Oscillatory networks. # ## Figure 4.15 (A) - -using DifferentialEquations +using OrdinaryDiffEq using Plots Plots.default(linewidth=2) diff --git a/docs/figs/ch4-18.jl b/docs/figs/ch4-18.jl index ff3028d0..f31c1903 100644 --- a/docs/figs/ch4-18.jl +++ b/docs/figs/ch4-18.jl @@ -5,8 +5,8 @@ Continuation diagram See also [BifurcationKit.jl](https://github.com/bifurcationkit/BifurcationKit.jl) ===# - -using DifferentialEquations +using OrdinaryDiffEq +using SteadyStateDiffEq using Plots Plots.default(linewidth=2) diff --git a/docs/figs/ch4-22.jl b/docs/figs/ch4-22.jl index 5cdcb292..36ca4cc5 100644 --- a/docs/figs/ch4-22.jl +++ b/docs/figs/ch4-22.jl @@ -5,7 +5,6 @@ Tangent line. Using ForwardDiff to calculate the derivative on a curve. ===# - using ForwardDiff using Plots Plots.default(linewidth=2) diff --git a/docs/figs/ch5-10.jl b/docs/figs/ch5-10.jl index 1962d135..33afd144 100644 --- a/docs/figs/ch5-10.jl +++ b/docs/figs/ch5-10.jl @@ -3,8 +3,7 @@ Methionine model ===# - -using DifferentialEquations +using OrdinaryDiffEq using SimpleUnPack using Plots Plots.default(linewidth=2) diff --git a/docs/figs/ch6-03.jl b/docs/figs/ch6-03.jl index 07b271f5..83c69acd 100644 --- a/docs/figs/ch6-03.jl +++ b/docs/figs/ch6-03.jl @@ -4,7 +4,8 @@ Two component pathway ===# using ModelingToolkit using Catalyst -using DifferentialEquations +using OrdinaryDiffEq +using DiffEqCallbacks using Plots Plots.default(linewidth=2) @@ -28,7 +29,7 @@ setdefaults!(rn, [ :k3 => 2., ]) -@variables t +@independent_variables t @unpack L = rn discrete_events = [[1.0] => [L~3.0], [3.0] => [L~0.0]] diff --git a/docs/figs/ch6-05.jl b/docs/figs/ch6-05.jl index 9ac20cb4..d5930879 100644 --- a/docs/figs/ch6-05.jl +++ b/docs/figs/ch6-05.jl @@ -5,7 +5,8 @@ Model of G-protein signalling pathway ===# using ModelingToolkit using Catalyst -using DifferentialEquations +using OrdinaryDiffEq +using DiffEqCallbacks using Plots Plots.default(linewidth=2) diff --git a/docs/figs/ch6-14.jl b/docs/figs/ch6-14.jl index 8eb3de73..27250afd 100644 --- a/docs/figs/ch6-14.jl +++ b/docs/figs/ch6-14.jl @@ -5,7 +5,8 @@ Model of E. coli chemotaxis signalling pathway ===# using ModelingToolkit using Catalyst -using DifferentialEquations +using OrdinaryDiffEq +using DiffEqCallbacks using Plots Plots.default(linewidth=2) diff --git a/docs/figs/ch6-16.jl b/docs/figs/ch6-16.jl index 916082b1..9fac1511 100644 --- a/docs/figs/ch6-16.jl +++ b/docs/figs/ch6-16.jl @@ -5,7 +5,8 @@ Model of apoptosis signalling pathway ===# using Catalyst using ModelingToolkit -using DifferentialEquations +using OrdinaryDiffEq +using DiffEqCallbacks using Plots Plots.default(linewidth=2) diff --git a/docs/figs/ch6-18.jl b/docs/figs/ch6-18.jl index bc10ffa3..820e59d5 100644 --- a/docs/figs/ch6-18.jl +++ b/docs/figs/ch6-18.jl @@ -5,7 +5,8 @@ Model of calcium-induced calcium release in hepatocytes ===# using Catalyst using ModelingToolkit -using DifferentialEquations +using OrdinaryDiffEq +using DiffEqCallbacks using Plots Plots.default(linewidth=2) diff --git a/docs/figs/ch7-07.jl b/docs/figs/ch7-07.jl index 6ca2bdf0..e84222f6 100644 --- a/docs/figs/ch7-07.jl +++ b/docs/figs/ch7-07.jl @@ -5,7 +5,9 @@ model of lac operon in E. coli ===# using Catalyst using ModelingToolkit -using DifferentialEquations +using OrdinaryDiffEq +using SteadyStateDiffEq +using DiffEqCallbacks using Plots Plots.default(linewidth=2) diff --git a/docs/figs/ch7-11.jl b/docs/figs/ch7-11.jl index 13fd5d30..4b19d4f9 100644 --- a/docs/figs/ch7-11.jl +++ b/docs/figs/ch7-11.jl @@ -3,8 +3,7 @@ Model of phage lambda decision switch ===# - -using DifferentialEquations +using OrdinaryDiffEq using Plots Plots.default(linewidth=2) diff --git a/docs/figs/ch7-17.jl b/docs/figs/ch7-17.jl index ac7f3afd..aded561b 100644 --- a/docs/figs/ch7-17.jl +++ b/docs/figs/ch7-17.jl @@ -6,7 +6,7 @@ Goodwin oscillator model: https://en.wikipedia.org/wiki/Goodwin_model_(biology) using Catalyst using ModelingToolkit -using DifferentialEquations +using OrdinaryDiffEq using Plots Plots.default(linewidth=2) diff --git a/docs/intro-01-first-steps.jl b/docs/intro-01-first-steps.jl index aab30c19..f5bc8078 100644 --- a/docs/intro-01-first-steps.jl +++ b/docs/intro-01-first-steps.jl @@ -242,7 +242,7 @@ str2 = "5009" string("The class is ", str1, '-', str2, ".") # Use string interpolation -"The class is $str1-$str2." +"The class is $(str1)-$(str2)." # concat string using `*` str1*"-"*str2 diff --git a/docs/intro-03-diffeq.jl b/docs/intro-03-diffeq.jl index fee5fe71..f9426281 100644 --- a/docs/intro-03-diffeq.jl +++ b/docs/intro-03-diffeq.jl @@ -13,7 +13,7 @@ - Define a problem (e.g. `ODEProblem`) using the modeling function (`f`), initial conditions (`u0`), simulation time span (`tspan == (tstart, tend)`), and parameter(s) `p`. - Solve the problem by calling `solve(prob)`. -## Solve ODEs using DifferentialEquations.jl +## Solve ODEs using OrdinaryDiffEq.jl Documentation: @@ -33,7 +33,7 @@ $$ ===# -using DifferentialEquations +using OrdinaryDiffEq using Plots Plots.default(linewidth=2) @@ -89,7 +89,7 @@ $$ ===# -using DifferentialEquations +using OrdinaryDiffEq using Plots Plots.default(linewidth=2) @@ -123,7 +123,7 @@ plot(sol, label=["S" "I" "R"], legend=:right) ===# using ModelingToolkit -using DifferentialEquations +using OrdinaryDiffEq using Plots Plots.default(linewidth=2) @@ -159,7 +159,7 @@ $$ \end{align} $$ ===# -using DifferentialEquations +using OrdinaryDiffEq using ModelingToolkit using Plots Plots.default(linewidth=2) @@ -171,8 +171,8 @@ function build_lorentz(; name) β=8/3 end + @independent_variables t @variables begin - t ## Independent variable (time) x(t)=1.0 ## Independent variable (time) y(t)=0.0 ## Independent variable (time) z(t)=0.0 ## Independent variable (time) @@ -214,8 +214,7 @@ CSV.write("lorenz.csv", df) rm("lorenz.csv") # ### SIR model - -using DifferentialEquations +using OrdinaryDiffEq using ModelingToolkit using Plots Plots.default(linewidth=2) @@ -246,9 +245,8 @@ plot(sol) [Catalyst.jl](https://github.com/SciML/Catalyst.jl) is a domain-specific language (DSL) package to simulate chemical reaction networks. ===# - using Catalyst -using DifferentialEquations +using OrdinaryDiffEq using Plots Plots.default(linewidth=2) diff --git a/docs/intro-04-gillespie.jl b/docs/intro-04-gillespie.jl index 811d4a1d..d9ee4904 100644 --- a/docs/intro-04-gillespie.jl +++ b/docs/intro-04-gillespie.jl @@ -3,7 +3,6 @@ ## Gillespie Algorithm ===# - using StatsBase ## Weights() and sample() using Plots using Interpolations @@ -15,7 +14,6 @@ Random.seed!(2022) Stochastic chemical reaction: Gillespie Algorithm (direct method) Adapted from: Chemical and Biomedical Enginnering Calculations Using Python Ch.4-3 ===# - function ssa_direct(model, u0::AbstractArray, tend, p, stoich; tstart=zero(tend)) t = tstart ## Current time ts = [t] ## Time points @@ -132,9 +130,8 @@ fig1 |> display [Catalyst.jl](https://github.com/SciML/Catalyst.jl) is a domain-specific language (DSL) package to solve law of mass action problems. ===# - using Catalyst -using DifferentialEquations +using JumpProcesses using Plots rn = @reaction_network begin