From b15437903699285b87a96c5914ac60055467075d Mon Sep 17 00:00:00 2001 From: ChrisRackauckas-Claude Date: Sat, 12 Sep 2026 05:22:56 -0400 Subject: [PATCH] Remove contradictory SEIRHD observable defaults Co-Authored-By: Chris Rackauckas Co-Authored-By: OpenAI Codex Agent-Harness: Codex CLI 0.153.4 Agent-Model: gpt-6-astra Agent-Session: local session ID 01a0598f-11b9-72d1-91d9-b2fbb186557d --- docs/src/examples/SEIRHD.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/src/examples/SEIRHD.md b/docs/src/examples/SEIRHD.md index b035ed0..54284ec 100644 --- a/docs/src/examples/SEIRHD.md +++ b/docs/src/examples/SEIRHD.md @@ -4,10 +4,12 @@ First, let's implement the classic SEIRHD epidemic model with ModelingToolkit: ```@example seirhd using DifferentialEquations, Distributions, EasyModelAnalysis, ModelingToolkit, Plots +using SciMLBase: successful_retcode @independent_variables t Dₜ = Differential(t) @variables S(t)=0.9 E(t)=0.05 I(t)=0.01 R(t)=0.2 H(t)=0.1 D(t)=0.01 -@variables T(t)=0.0 η(t)=0.0 cumulative_I(t)=0.0 +@variables T(t) η(t) +@variables cumulative_I(t)=0.0 @parameters β₁=0.6 β₂=0.143 β₃=0.055 α=0.003 γ₁=0.007 γ₂=0.011 δ=0.1 μ=0.14 eqs = [T ~ S + E + I + R + H + D η ~ (β₁ * E + β₂ * I + β₃ * H) / T @@ -22,6 +24,10 @@ eqs = [T ~ S + E + I + R + H + D seirhd = structural_simplify(seirhd) prob = ODEProblem(seirhd, [], (0, 110.0)) sol = solve(prob) +@assert successful_retcode(sol) +@assert [sol[state][1] for state in [S, E, I, R, H, D, cumulative_I]] == + [0.9, 0.05, 0.01, 0.2, 0.1, 0.01, 0.0] +@assert all(isfinite, Array(sol)) plot(sol) ```