Skip to content

Commit 7f2c8c1

Browse files
committed
fix tutorial again
1 parent dd1e132 commit 7f2c8c1

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

docs/Project.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ LinearSolve = "2.30"
5959
ModelingToolkit = "9.32"
6060
NonlinearSolve = "3.12"
6161
Optim = "1.9"
62-
Optimization = "3.25"
63-
OptimizationBBO = "0.3"
64-
OptimizationNLopt = "0.2.1"
65-
OptimizationOptimJL = "0.3.1"
66-
OptimizationOptimisers = "0.2.1"
62+
Optimization = "4"
63+
OptimizationBBO = "0.4"
64+
OptimizationNLopt = "0.3"
65+
OptimizationOptimJL = "0.4"
66+
OptimizationOptimisers = "0.3"
6767
OrdinaryDiffEq = "6.80.1"
6868
Plots = "1.40"
6969
QuasiMonteCarlo = "0.3"

docs/src/model_creation/examples/hodgkin_huxley_equation.md

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,22 +171,29 @@ hhmodel2 = @reaction_network hhmodel2 begin
171171
end
172172
```
173173
Finally, we extend the `hhmodel` with the systems defining the ion channel currents
174-
```julia
174+
```@example hh1
175175
for sys in (IKmodel, INamodel, ILmodel)
176176
@named hhmodel2 = extend(sys, hhmodel2)
177177
end
178178
hhmodel2 = complete(hhmodel2)
179179
```
180-
Starting from the resting state, let's again solve the system when the amplitude
181-
of the stimulus is non-zero and check we get the same figure as above. Note, we
182-
now run `structural_simplify` from ModelingToolkit as part of building the
183-
`ODEProblem` to eliminate the algebraic equations for the currents
180+
Let's again solve the system for the resting state, and then solve with the same
181+
applied current as above (to verify we get the same figure). Note, we now
182+
explicitly convert to an `ODESystem` and then run `structural_simplify` from
183+
ModelingToolkit to eliminate the algebraic equations for the ionic currents
184184

185185
```@example hh1
186+
osys = convert(ODESystem, hhmodel2)
187+
osys = structural_simplify(osys)
188+
186189
tspan = (0.0, 50.0)
190+
u₀ = symmap_to_varmap(osys, [:V => -70, :m => 0.0, :h => 0.0, :n => 0.0,
191+
:m′ => 1.0, :n′ => 1.0, :h′ => 1.0])
192+
oprob = ODEProblem(osys, u₀, tspan)
193+
hhsssol = solve(oprob, Rosenbrock23())
194+
u_ss = unknowns(osys) .=> hhsssol(tspan[2], idxs = unknowns(osys))
187195
@unpack I₀,V = hhmodel2
188-
oprob = ODEProblem(hhmodel2, u_ss, tspan, [I₀ => 10.0];
189-
structural_simplify = true)
196+
oprob = ODEProblem(osys, u_ss, tspan, [I₀ => 10.0])
190197
sol = solve(oprob)
191198
plot(sol, idxs = V, legend = :outerright)
192199
```

0 commit comments

Comments
 (0)