On GitHub, AllenDowney/ModSimPy has picked up 939 stars, Jupyter Notebook. Text and supporting code for Modeling and Simulation in Python
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
Modeling and Simulation in Python is an introduction to physical modeling in Python, suitable for people with no programming experience.
Printed and electronic copies of the book are available from No Starch Press and Bookshop.org and Amazon.
Here is the home page for this book at Green Tea Press.
Read the book and run the code.
Read documentation of the modsim.py module
The notebooks download modsim.py from this repository, so there is nothing to install. The modsimpy package on PyPI (last released in 2020) is outdated and no longer maintained.
Outline
Modeling and Simulation in Python is an introduction to physical modeling using a computational approach. It is organized in three parts:
The first part presents discrete models, including a bikeshare system and world population growth.
The second part introduces first-order systems, including models of infectious disease, thermal systems, and pharmacokinetics.
The third part is about second-order systems, including mechanical systems like projectiles, celestial mechanics, and rotating rigid bodies.
Taking a computational approach makes it possible to work with more realistic models than what you typically see in a first-year physics class, with the option to include features like friction and drag.
Python is an ideal programming language for this material. It is a good first language for people who have not programmed before, and it provides high-level data structures that are well-suited to express solutions to the problems we are interested in.
Installation
For Users
To set up the environment for running the notebooks, you can use either conda or mamba:
mamba env update -f environment.yml --prune
# or
make update_environment
Development environment:
mamba env update -f environment-dev.yml --prune
# or
make update_environment_dev
Development
Three repositories are involved:
ModSimPy (this one, public, branch master): the notebooks without solutions (chapters/, examples/), the modsim.py library, and the Jupyter Book site, published on the gh-pages branch.
ModSimPySolutions (private, branch master): where development happens and the solutions live. It is cloned inside this working tree as ModSimPySolutions/ (gitignored here). Its GitHub Actions run the notebooks on every push and once a month.
ModSim (AllenDowney/ModSim, branch main): figures and data shared with the MATLAB version.
The canonical copy of modsim.py is modsim/modsim.py, next to its tests (modsim/test_modsim.py). modsim/build.sh copies it everywhere else; edit only that copy. The top-level modsim.py and chapNN.py files, data/World_population_estimates.html, and figs/baseball_drag.png must stay where they are: the notebooks download them from github.com/AllenDowney/ModSimPy/raw/master/....
Updating a notebook
Edit the notebook in ModSimPySolutions/chapters/ or ModSimPySolutions/examples/.
Run the whole pipeline with make build, or the steps one at a time:
cd modsim && sh build.sh # copy modsim.py to all locations
cd ModSimPySolutions/chapters && sh build.sh # commit and push solutions; export and commit chapNN.py in ModSimPy
cd ModSimPySolutions && sh build.sh # zip of the solution notebooks
cd examples && sh build.sh # copy notebooks, remove solutions, commit
cd chapters && sh build.sh # same for the chapters, then rebuild the notebook zip
git push # push ModSimPy once
sh build.sh # MkDocs API docs into site/
cd jb && sh build.sh # build the Jupyter Book and push gh-pages
The ModSimPy scripts only commit; push once at the end, since every push to master runs CI. Run examples before chapters, because the notebook zip includes both.
Testing
Testing is a separate step from building:
make tests # modsim unit tests and the chapter notebooks
cd ModSimPySolutions && make tests # all notebooks, with solutions
cd chapters && sh test_run.sh # refresh the chapters from ModSimPySolutions and test them
Some of the examples don't run without their solutions, so they aren't tested here.
License
The text of the book is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. The code, including modsim.py, is under the MIT License (see LICENSE).
This and other Free Books by Allen Downey are available from Green Tea Press.
How active is development on AllenDowney/ModSimPy?
The most recent commit recorded on AllenDowney/ModSimPy was 18 days ago, based on the GitHub push timestamp. The repository has 1.8k forks — one of the better signals of community interest.
How many stars does AllenDowney/ModSimPy have?
AllenDowney/ModSimPy has 939 GitHub stars — refresh the page for the live number, or check github.com/AllenDowney/ModSimPy. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is AllenDowney/ModSimPy open source?
Yes — AllenDowney/ModSimPy ships under the MIT license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/AllenDowney/ModSimPy.
What is AllenDowney/ModSimPy?
AllenDowney/ModSimPy (AllenDowney/ModSimPy) is a Jupyter Notebook project on GitHub. From the project's own README: Text and supporting code for Modeling and Simulation in Python
What language is AllenDowney/ModSimPy written in?
AllenDowney/ModSimPy is written primarily in Jupyter Notebook. GitHub's language field is based on the largest share of bytes in the default branch.
What license does AllenDowney/ModSimPy use?
AllenDowney/ModSimPy is released under the MIT license. Always verify the LICENSE file directly on GitHub for the authoritative terms — license strings can be edited out of sync with a project's actual stance.
Where do I read more about AllenDowney/ModSimPy?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/AllenDowney/ModSimPy is the definitive source.
Read full README in the tab above.
Is ModSimPy worth your time?
ChatGPT, Claude and Perplexity can all read this page. Ask one of them what it makes of ModSimPy.