# Foreword

I live on an island about fifty miles south of Houston, Texas, and I wander down to the beach most evenings to watch the sunset. Some days, the clouds in the east catch a bit of pink light and transform into gobs of cotton candy. Other days, the water glimmers just before dusk. Each new variant helps to complete my mental model of the island, and I find this learning process beautifully satisfying. If you think about it, we all constantly develop models of how our world works, and we use those models to shape the world in turn.

Math and code can lead to many unexpected adventures. Sometimes, I look up at scenes like a sunshower (when rain falls while the sun is shining) and try to relate my impression of it via computation. I can’t draw, but I can code, so I maintain a software sketchbook full of visual experiments like simulated rain. In one such experiment, I connected with an artist interested in sculpting with pieces that synchronize like members of a honeybee swarm. I wound up studying old code buried in an obscure master’s thesis before implementing a version that the artist could use to control the position, sound, and color of their work.

Then there are the more scientific projects I’ve tackled like those concerning flood risk. Given data on surface elevation, past storm surges, and projected sea level rise, how would you quantify a community’s risk of catastrophic flood damage? I’ve collaborated with researchers at the Galveston Historical Foundation and the Wharton Risk Center to combine spatial analysis, statistics, and mapping in an effort to tell the full story.

My mission as a teacher is to build students’ creative confidence and analytical ability. I’m an engineer by training, so I can’t help but look at instruction as a design problem. Hundreds of students have entered my classroom with diverse interests, experiences, and motivations. Engaging them all in a way that is both rigorous and inclusive is hard to do, and I don’t always succeed. The lessons that go well tend to have a few things in common: they are grounded in students’ interests, they promote self-expression, and they allow for multiple pathways to success.

I’ve been fortunate to teach math and computer science in environments that encourage new ideas. Texas’ public education standards set the constraints, and I use them to plan my search for better math lessons. This book presents a sequence of lessons that grew out of my Algebra 2, Precalculus, and AP Computer Science A courses over several years. Most have seen a few iterations, while some were dreamed up and tested during writing.

## For the Solo Student

You are in for quite a ride. The exercises in this book are structured to help you master foundational topics in simulation, analysis, and design. Please allow me to offer two pieces of advice as you start this journey: First, complete every exercise, even if you get stuck on one and need to revisit it later. Second, learning is more fun with friends! Consider joining the Processing Foundation Discourse.

## For the Instructor

The material in this book maps to a high school course in Precalculus or a pair of courses in College Algebra and Trigonometry. The projects in each chapter complement existing curriculum and grew out of my own standards-aligned math courses. My students and I code together in class for 90–135 minutes during each unit of instruction.

This book was designed as a small, evolutionary step forward for math instruction. Topics build toward Calculus as expected, but also in a sequence motivated by their usefulness to solving problems in simulation, analysis, and design. Mathematical notation is complemented with computer code written in Python so that students develop both modes of expression simultaneously.

The text and coding environment are free, both as in “free snacks” as well as “free speech”. Instructors can try out a few lessons, adopt the full text, or even remix it with minimal friction.

To paraphrase Dr. Dre on the order of songs in an album, sequence matters almost as much as the content itself. Chapters 1–4 cover foundational topics in algebra and programming used throughout the rest of the book. The middle chapters 5–7 can be shuffled based on preference, and I recommend concluding with chapters 8–10.

And now for the “how”. There is no playbook for developing people’s creative problem solving skills, but useful patterns have emerged. The following computational thinking process was outlined by Conrad Wolfram, CEO of Wolfram Research, in his book *The Math(s) Fix*:

Computational Thinking Process (Wolfram Model)

- Define Questions
- Abstract to Computable Form
- Compute Answers
- Interpret Results

Step 4 often reveals new questions or shortcomings of answers produced in Step 3, so it starts another iteration of the process. Thinking of learning in cycles brings to mind the “Creative Learning Spiral,” which Mitchel Resnick, Professor at the MIT Media Lab, outlined in his book *Lifelong Kindergarten*.

Creative Learning Spiral (Resnick Model)

- Imagine
- Create
- Play
- Share
- Reflect

Step 5 similarly tends to kick off another trip around the spiral. I’ll go out on a limb and claim that most worthwhile problems are not solved easily or directly. And it seems clear that serious problem solving requires time to plan, time to work, and time to reflect. My variation on the themes presented by Wolfram and Resnick is the following:

Computiful Model

- Define System
- Model with Math
- Prepare Data
- Code and Run
- Reflect on Results

Ready? Let’s start the first iteration.

*Nick McIntyre*

Galveston, December 2020