Download the Hacking Math Class book in PDF format!

Click the Button to Pay by Credit Card or Paypal.



21st Century Math Education

Hacking Math Class is the first book of its kind to combine computer programming with learning math. No previous programming experience is required. The book takes you through the basics of getting a computer to do what you want it to do. Then you learn how to apply those programming tools to learning math.

Years ago I taught math to a homeschooled young man who was a computer programming enthusiast. I made sure every homework assignment I gave him contained a computer programming challenge so he could dig deeper into the concepts he learned that week. I got bitten by the programming bug myself and I set out to apply it to every imaginable math topic. In a very short time, I had written Python programs for exploring math topics from Algebra and Geometry to Calculus and Statistics!

Now you can explore math topics like Algebra, Geometry, Trigonometry and Calculus using the Python programming language. You'll learn to create tools like graphers and solvers to help you learn about functions and fractals!

All the code necessary to create the graphics on this page, fractals, 3D models and more are in the book.

View the entire Algebra chapter by clicking this link:

Algebra Chapter

Table of Contents

1. Introduction to Programming

  • Tools
  • Python
  • Installation
  • The Turtle Module
  • Using the Turtle Module
  • Using Loops 
  • Defining Functions 
  • Using Variables
  • Loops and Printing
  • While loops 

2. Arithmetic 

  • Functions
  • Conditionals and Input 
  • Conditionals 
  • User Input 
  • The random module 
  • Lists 
  • The Modulo Operator 

3. Algebra

  • Solving Higher-Degree Equations 
  • Major Math Tool: Create Your Own Grapher
  • Synthetic Division 
  • Exploring Prime Numbers 
  • Binary Numbers 

4. Geometry 

  • Finding intersections of lines 
  • Finding Area of a Triangle Using Heron’s Formula
  • Finding Lines Through Points 
  • Perpendicular Bisector
  • Distance from a point to a line 
  • Circumcircle 
  • Centroid 

5. Trigonometry

  • Sines and Cosines
  • Harmonographs
  • Spirograph
  • Radians

6. 3D Graphics

  • Vectors 
  • The Solar System Model 

7. Recursion and Fractals 

  • Fractal Trees
  • Pythagorean Tree 
  • Koch Snowflake 
  • Sierpinski Triangle

8. Matrices 

  • Entering Matrices as Lists 
  • Transforming Points using Matrices 
  • Multiplying Matrices
  • Rotation matrices 

9. Series

  • Iteration 

10. Complex Numbers 

  • Polar Form 
  • DeMoivre’s Theorem 
  • Graphing Complex Multiplication 
  • Mandelbrot Set

11. Probability

  • Permutations and Combinations
  • Standard Deviation

12. Calculus 

  • Derivatives
  • Newton’s Method 
  • Integrals 
  • Numerical Integration 
  • The Trapezoidal Method 
  • Differential Equations 
  • The Runge Kutta Method


Answers to Exercises  

Can't Install Pi3D?

If you have a Windows computer and can't easily install Pi3D, never fear! You can still have fun making 3D Graphics using Visual Python. Just download this version of the 3D Graphics chapter and then install VPython on your computer:

Visual Python 3D Graphics Chapter

If you're lucky enough to live in the San Francisco Bay area, you can sign up to attend my hands-on Math Through Technology Program!

What is Math Through Technology?

"Computer Science is the New Mathematics" - Christos H. Papadimitriou

Math Through Technology is a course intended to enable math students to explore math and science topics deeply by using Python programming.

It's not about avoiding math using calculators! It's about automating the boring stuff so you can get to the fun stuff, like Calculus.

Programming Tools

It's like Minecraft, where you make wood tools, and using wood tools, you can mine stone to make stone tools, and so on. In computer programming you create functions you can use as tools to create more and more powerful tools.

21st Century Skills

It's still important to be able to think mathematically.

It's equally important to be able to solve problems using appropriate technology. 

The Python Programming Language

Developed in the late 1990s by Guido van Rossum, Python has become one of the top 3 popular programming languages, with Java and C++. It's widely used in research and industry, and it has applications in everything from web pages (like this one!) to 3D graphics to databases, music and hardware. 

While you're learning to solve equations, you'll also be learning marketable skills in a hugely popular programming language.

Learn more about Math Through Technology here!