Go on Some ‘Math Adventures With Python’

Books Computing Education Reviews

If you’re a mathy type and want to get into some computer programming, or if you’re a computer person but want to learn what kinds of math you can do with code, a new book out from No Starch Press will help you achieve those goals. It’s also perfect for doing with your kids, or just diving into yourself.

Math Adventures With Python: An Illustrated Guide to Exploring Math With Code by Peter Farrell takes you through how to do both basic and more involved math using the Python language. This book sounded a bit intimidating to me at first since I knew no Python. I do have a decent math and programming background from college, but that was 25 years ago. And I was sure that Python was different from my old standbys, Pascal and C++. Could I learn Python using this book? Would I be lost? I needn’t have worried. I felt guided and supported from page 1.

Math Adventures With Python takes users through, step by step, how to install Python 3 on their machines and how to use the programming interface. You start by installing Python 3 itself (it’s called IDLE when you run it, after Eric Idle of Monty Python, of course), and also installing a processor application (called Processing) for graphics and interactivity. It sounds more complicated than it is. Just follow the instructions and you’ll be fine. I’m not sure what I was expecting in terms of an interface, but I thought it would be more graphics heavy. It looks just like a text editor, but it has extra capabilities built in, which appear as you start typing commands.

This slideshow requires JavaScript.

The lessons then start easy, having you just draw basic lines and create simple outputs, including using the LOGO-style turtle to draw shapes. After you learn how to use loops to draw a square, you jump right into creating your own functions. Then, after you’ve learned a few more things, the book challenges you to apply what you’ve learned so far to implement something new that you aren’t given explicit instructions for. It’s a great method for learning.

Complexity of topics and lessons ramps up slowly and logically, gradually covering such topics as:

  • Drawing polygons
  • Doing arithmetic with lists and loops
  • Using conditionals
  • Make similar shapes
  • Trigonometry and triangles
  • Spirals
  • Taking user input
  • Graphing equations
  • Using colors
  • Animating objects
  • Learning data types such as integers, floats, strings, and Booleans
  • Using a circle to draw sine waves
  • Creating your own Spirograph
  • Complex numbers
  • Solving systems of equations with matrices (including Gaussian Elimination!)
  • Building objects with classes
  • Creating fractals, including with color, both with and without recursion
  • Cellular automata
  • Genetic algorithms

I especially enjoyed the fractals section, learning to create the Mandelbrot set, then the Julia set. I spent hours playing with Fractint as a teenager, so I enjoyed seeing the computations behind these fractals. Adding in recursion, the book also helps you create fractal-based trees, Koch snowflakes, the Sierpinski triangle, and more.

You then learn how to build your own sheep grazing simulation!

The book not only shows you how to implement math concepts in a coding environment, it also describes why we do or would want to do certain math tasks. As you go, it explains what all of the Python commands are and how to use them. It’s a very detailed and informative book, and will teach you how to implement sometimes complicated math concepts in Python by the time you’re done going through it. It’s easy to find your way around the book since it has two tables of contents: one for at-a-glance navigation, and one in more detail, which breaks the book down almost page by page. There is also an index.

Though having programming experience of any kind is helpful when working through the book since it makes the learning curve more gradual, anyone who can follow directions and think critically will be able to learn everything the book has to offer. Those users new to Python, though, will want to work through this book from front to back, since the lessons build on each other.

Even though this was my first real introduction to the Python language, my background in programming and math was helpful for me to understand what they were trying to accomplish. But that kind of background definitely isn’t necessary for understanding the book and following its detailed instructions; it breaks the projects down into small steps, helping those working through the book see almost instant results, including kids (though parents may need to do the program installation to get things started).

If you love math and have always wanted to dig deeper while using computer programs to implement some fun math-based projects, Math Adventures With Python is the perfect book for you. Though it does help a bit to have even a modest background in higher math (post-arithmetic) and computer programming basics, any patient student, probably high school age to adult, will feel like they have enough guidance to go from directing a turtle to draw a basic square, all the way to creating gorgeous, colorful fractals. This book steps you through everything you need to do and know, and it will empower you to create program variations and play around with your newfound toolset. I recommend it highly.

Note: I received a copy of this book for review purposes, but all nostalgia for my math and computer science days are all my own.

Liked it? Take a second to support GeekDad and GeekMom on Patreon!
Become a patron at Patreon!

4 thoughts on “Go on Some ‘Math Adventures With Python’

  1. Thanks for the detailed review of my book! So happy you found it so much fun. The fractal chapter was also one of my favorites to write. It could have been twice as long!

    1. Such a great book. You created something informative, fascinating, funny, and easy to follow. Maybe you should write a book dedicated to fractals! When I was in college I took a class on symmetry, and my big project for the class was about fractals. I had printed out the manual for Fractint at that point, which served as a textbook for how fractals work. This kind of thing has fascinated me since the early ’90s.

  2. Hi. Thank you for your review. I came across _Math Adventures with Python_ in the bookstore and instantly think about my homeschooling children. I found your blogpost buy searching for reviews. I think this is a fantastic idea. I am curious how much math and at what are my kids could comfortably delve into thugs book. What would you suggest?

    1. Hi Jason! It depends on how old your kids are. The math starts out pretty basic, but gets sophisticated (high school level and beyond) as the book goes on. Check out the table of contents on Amazon’s Look Inside feature to see whether it’s a good match for your kids! https://amzn.to/2V9Tuve

Comments are closed.