Hello! This book is designed to take you on a journey, from counting with blocks to creating an artificial intelligence. We’ll start simple and develop each idea organically.

Written by Nick McIntyre

Edited by Isabella Tang

## Acknowledgements

Creative Coding: the blueprint for introducing signals and audio synthesis in Chapter 6.

Deep Learning: the blueprint for introducing Calculus and machine learning in Chapter 10.

Linear Algebra: Foundations to Frontiers: the blueprint for introducing linear algebra in Chapters 8 and 9.

The Nature of Code: one of my favorite books and a key inspiration for this project.

OpenStax: a great collection of free textbooks referenced at the end of each chapter.

p5.js: a delightful JavaScript library for creative coding used throughout the book.

p5.js Web Editor: the code editor adapted for use with this book.

pyp5js: a library that makes it possible to write p5.js sketches in Python.

## Dedication

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

## Preface

Here’s the plan: I will show you 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.