by Allen Downey

Download the new fourth edition in PDF.

Buy the first edition from Lulu.com or Amazon.com

Supporting MATLAB code and the LaTeX source for the book are in this GitHub repository.

### Description:

Modeling and simulation are powerful tools for explaining the world, making predictions, designing things that work, and making them work better. Learning to use these tools can be difficult; this book is my attempt to make the experience as enjoyable and productive as possible.

By reading this book — and working on the exercises — you will learn some programming, some modeling, and some simulation:

- With basic programming skills, you can create models for a wide range of physical systems. My goal is to help you develop these skills in a way you can apply immediately to real-world problems.
- This book presents the entire modeling process, including model selection, analysis, simulation, and validation. I explain this process in Chapter 1, and there are examples throughout the book.
- Simulation is an approach to modeling that uses computer programs to implement models and generate predictions. This book shows how simulations are used to run experiments, answer questions, and guide decision-making.

To make this book accessible to the widest possible audience, I try to minimize the prerequisites.

In particular, this book is intended for people who have never programmed before. I start from the beginning, define new terms when they are introduced, and present only the features you need, when you need them.

I assume that you know trigonometry and some calculus, but not much. If you understand that a derivative represents a rate of change, that’s enough. You will learn about differential equations and some linear algebra, but I will explain what you need to know as we go along.

I assume you know basic physics, in particular the concepts of force, acceleration, velocity, and position. If you know Newton’s second law of motion in the form *F = m a*, that’s enough.

You will learn to use numerical methods to search for roots of non-linear equations, solve differential equations, and search for optimal solutions. You will learn how to use these methods first; then in Chapter 15 you will learn more about how they work. But if you can’t stand the suspense, you can look “under the hood” whenever you want.

I have tried to present a small set of tools that provides the most versatility and power, to explain them as clearly as possible, and to give you chances to practice what you learn.

This book is available under a Creative Commons license, which means that you are free to copy, distribute, and modify it, as long as you attribute the source and don’t use it for commercial purposes.