# Welcome¶

Hello! This book is designed to take you on a journey, from counting on your fingers to orchestrating swarms of digital creatures like the fireflies below. We’ll start simple and develop each idea organically.

The computer program above simulates the coordinated behavior exhibited by some species of fireflies. We can describe this behavior, known as ** synchronization**, to a computer using the following mathematical model:

This ** ordinary differential equation** conveys the following idea: “The way in which I change my direction \( \dot{\theta_{i}} \) is based upon my natural preference \( \omega_{i} \), my current direction \( \theta_{i} \), and the directions of my neighbors \( \theta_{j} \).”

Don’t worry if this collection of symbols seems inscrutable to you at the moment; you will learn to “talk mathematics” over the course of the book.

## Dedication¶

For my students, who teach me how to teach this stuff.

## Preface¶

Here’s the plan: I will show you how to model systems using one formal language (mathematics) so that you can explore them using another formal language (computer code). My hope for you, dear reader, is that you walk away from each exercise a little more confident that you can understand anything you see and construct anything you can imagine.

It’s not overselling it to say that modern life is entirely dependent upon math and code. More to the point, working at the intersection of these entwined fields can be a whole lot of fun.

## A Little Background¶

The Wikipedia entry on mathematics begins by highlighting core topics like quantity, structure, space, and change. Whether you’re into creating things or exploring the limits of knowledge, mathematics is a useful lens through which to view the world.

In 1936, two mathematicians named Alonzo Church and Alan Turing wanted to determine what functions could be computed; they ended up laying the foundation of computer science. It’s fitting that ** computational thinking**–thinking about problems in terms of systems, models, data, and algorithms–is a powerful approach to learning and applying mathematics.

The International Society for Technology in Education (ISTE) outlines the following core components in their computational thinking competencies.

** ****Systems** that enable decomposition.

**\( \mapsto \)** **Models** that distill essential features.

** ****Data** that computers can understand.

** ****Algorithms** that computers can execute.

This book emphasizes these components as part of a structured problem-solving process.