Chapter 4: System Dynamics¶
Part II — Simulation Paradigms
Implemented by the dissmodel-sysdyn package.
Live demo: try the models in this chapter directly in the browser — dissmodel-sysdyn-demo on Hugging Face Spaces.
Learning objectives¶
- Install and explore the system dynamics model library
- Run models via CLI, Streamlit, and notebooks
- Recognize the categories of available models
4.1 Installation¶
dissmodel-sysdyn's own README shows pip install dissmodel-sysdyn, but
the package has no PyPI release (no PyPI badge, no publish workflow) —
the main dissmodel repository's own ecosystem table documents the
actual install path as a direct GitHub install, same as every other
extension package (Chapter 3):
4.2 Included models by category¶
| Category | Models |
|---|---|
| Epidemiology | SIR |
| Ecology & Biology | Predator-Prey (Lotka-Volterra), Yeast Growth, Daisyworld, Population Growth, Limited Growth, Chaotic Growth |
| Physics & Thermodynamics | Coffee Cooling, Room Temperature, Tub (Stock/Flow) |
| Complex Systems | Lorenz Attractor, Homeostasis |
| Environment | Mono Lake Water Balance |
| Stochasticity | Random Walk |
4.3 Usage¶
python examples/cli/sysdyn_sir.py
streamlit run examples/streamlit/sysdyn_all.py
jupyter notebook examples/notebooks/
There are 14 educational notebooks, each functioning as a self-contained
tutorial with scientific context, mathematical formulation, and guided
experiments (e.g. sysdyn_daisyworld.ipynb on the Gaia hypothesis,
sysdyn_lorenz.ipynb on deterministic chaos).
Exercises¶
- Open
src/dissmodel_sysdyn/models/sir.py. Unlike every model in Chapter 5,SIRextendsdissmodel.core.Modeldirectly, notSpatialModel. Explain why a system-dynamics model has no need for agdf/backendor a neighborhood. SIRis decorated with three stacked@track_plot("Susceptible", "green")/@track_plot("Infected", "red")/@track_plot("Recovered", "blue")calls. Runpython examples/cli/sysdyn_sir.pyand identify, from the live chart, which compartment peaks first and why (hint: compare thedurationandcontactsdefault parameters documented in the class docstring).- Compare
sir.py(a compartmental model with discrete stocks) tolorenz.py(a continuous three-variable chaotic system). Both overrideexecute()on a plainModel— what does each model'sexecute()compute per tick, and why does neither needpre_executeorpost_execute? - Read the
sysdyn_daisyworld.ipynbnotebook's introduction and describe, in your own words, what the Gaia hypothesis claims and how the model's stocks (black daisies, white daisies, bare ground) operationalize it.
Summary¶
dissmodel-sysdyn shows that DisSModel's core lifecycle (setup →
execute, driven by Environment.run()) is not tied to spatial data at
all: every model here subclasses dissmodel.core.Model directly, with no
gdf, no backend, and no neighborhood — the state is just a handful of
numeric stocks (susceptible/infected/recovered, predator/prey
populations, x/y/z in the Lorenz system) advanced by ODE-like update
equations each tick. The @track_plot decorator is the piece that turns
any tracked attribute into an automatically-charted time series with no
extra plumbing, which is why every model in the package — from SIR to
Daisyworld to the Lorenz attractor — can be dropped into the same
Streamlit explorer (sysdyn_all.py) used for CA models in Chapter 5. The
14 notebooks are this package's main teaching surface: each pairs a
scientific framing (epidemiology, ecology, thermodynamics, deterministic
chaos) with the exact stock/flow equations implemented in
src/dissmodel_sysdyn/models/.