Hello! This book is an experiment based on a simple premise: learning to simulate the world around us is a powerful aid to understanding, so we should get started as early as possible. It’s dedicated to everyone who ever struggled to make it through a math class.

Over the course of a dozen or so chapters, you will progress from simulating the nighttime sky to developing an artificial intelligence, all using p5.js. We’ll start simple and keep the jargon to an absolute minimum.

## Background

The Wikipedia entry on mathematics begins by highlighting core topics including quantity, structure, space, and change. Whether you’re into creating works of art, making money, 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 were interested in determining what functions could be computed; they ended up laying the foundation of what we know as computer science. It’s fitting that computational thinking—the discipline of expressing and solving problems in a way computers can execute—is a great way to learn mathematics, especially when visualization is in the mix.

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.

## Acknowledgements

Shout out to Daniel Shiffman for his tireless efforts to make coding accessible for beginners and for making his book freely available.