This HTML version of Think Complexity, 2nd Edition is provided for convenience, but it is not the best format of the book. In particular, some of the symbols are not rendered correctly.
You might prefer to read the PDF version.
Chapter 0 Preface
Complexity science is an interdisciplinary field — at the intersection of mathematics, computer science and natural science — that focuses on complex systems, which are systems with many interacting components.
One of the core tools of complexity science is discrete models, including networks and graphs, cellular automatons, and agent-based simulations. These tools are useful in the natural and social sciences, and sometimes in arts and humanities.
For an overview of complexity science, see https://thinkcomplex.com/complex.
Why should you learn about complexity science? Here are a few reasons:
By reading this book and working on the exercises you will have a chance to explore topics and ideas you might not encounter otherwise, practice programming in Python, and learn more about data structures and algorithms.
Features of this book include:
For most of the links in this book I use URL redirection. This mechanism has the drawback of hiding the link destination, but it makes the URLs shorter and less obtrusive. Also, and more importantly, it allows me to update the links without updating the book. If you find a broken link, please let me know and I will change the redirection.
0.1 Who is this book for?
The examples and supporting code for this book are in Python. You should know core Python and be familiar with its object-oriented features, specifically using and defining classes.
If you are not already familiar with Python, you might want to start with Think Python, which is appropriate for people who have never programmed before. If you have programming experience in another language, there are many good Python books to choose from, as well as online resources.
I use NumPy, SciPy, and NetworkX throughout the book. If you are familiar with these libraries already, that’s great, but I will also explain them when they appear.
I assume that the reader knows some mathematics: I use logarithms in several places, and vectors in one example. But that’s about it.
0.2 Changes from the first edition
For the second edition, I added two chapters, one on evolution, the other on the evolution of cooperation.
In the first edition, each chapter presented background on a topic and suggested experiments the reader could run. For the second edition, I have done those experiments. Each chapter presents the implementation and results as a worked example, then suggests additional experiments for the reader.
For the second edition, I replaced some of my own code with standard libraries like NumPy and NetworkX. The result is more concise and more efficient, and it gives readers a chance to learn these libraries.
Also, the Jupyter notebooks are new. For every chapter there are two notebooks: one contains the code from the chapter, explanatory text, and exercises; the other contains solutions to the exercises.
Finally, all supporting software has been updated to Python 3 (but most of it runs unmodified in Python 2).
0.3 Using the code
All code used in this book is available from a Git repository on GitHub: https://thinkcomplex.com/repo. If you are not familiar with Git, it is a version control system that allows you to keep track of the files that make up a project. A collection of files under Git’s control is called a “repository”. GitHub is a hosting service that provides storage for Git repositories and a convenient web interface.
The GitHub homepage for my repository provides several ways to work with the code:
I developed this book using Anaconda from Continuum Analytics, which is a free Python distribution that includes all the packages you’ll need to run the code (and lots more). I found Anaconda easy to install. By default it does a user-level installation, not system-level, so you don’t need administrative privileges. And it supports both Python 2 and Python 3. You can download Anaconda from https://continuum.io/downloads.
The repository includes both Python scripts and Jupyter notebooks. If you have not used Jupyter before, you can read about it at https://jupyter.org.
There are three ways you can work with the Jupyter notebooks:
Good luck, and have fun!
Allen B. Downey
Professor of Computer Science
Olin College of Engineering
Let me know what version of the book you are working with, and what format. If you include at least part of the sentence the error appears in, that makes it easy for me to search. Page and section numbers are fine, too, but not quite as easy to work with. Thanks!
I would especially like to thank the technical reviewers, Vincent Knight and Eric Ma, who made many helpful suggestions, and the copy editor, Charles Roumeliotis, who caught many errors and inconsistencies.
Other people who reported errors include Richard Hollands, Muhammad Najmi bin Ahmad Zabidi, Alex Hantman, and Jonathan Harford.
Are you using one of our books in a class?We'd like to know about it. Please consider filling out this short survey.