Modeling and Simulation in Python

by Allen B. Downey


Download the current draft of this book in PDF.

The code for this book is in this GitHub repository.


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 chemical kinetics.
  • 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.

Modeling and Simulation in Python is a Free Book. It is available under the Creative Commons Attribution-NonCommercial 3.0 Unported License, which means that you are free to copy, distribute, and modify it, as long as you attribute the work and don’t use it for commercial purposes.

Other Free Books by Allen Downey are available from Green Tea Press.