Math Adventures with Python

Author: Peter Farrell
Publisher: No Starch Press
Pages:304
ISBN: 978-1593278670
Print: 1593278675
Kindle: B074653Z4D
Audience: Hobby programmers
Rating: 4
Reviewer: Mike James
Python is popular, math isn't. Perhaps this can be solved!

The subtitle of this book is "An Illustrated Guide to Exploring Math with Code" which is a great idea and not a new one. First let me remind everyone that math is not the same as arithmetic, and why we spend so much time teaching rote arithmetic when a 50 cent calculator can do so much better, I really don't know. Ever since computers were available math has been free from the mechanical drudgery of arithmetic, yet the world of education and the people who judge it still insist that you have to master mental arithmetic before moving on to real math. How many mathematicians are we losing because of this stupidity.

All books that attempt to teach math using programming have to some extent to teach the programming. This book doesn't go into much depth when it comes to Python, which is probably a good thing. You might need to consult some other texts if you are a complete programming beginner. It also makes use of Python libraries to get things done, which is fine, but for graphics it also uses the Python implementation of Processing, an alternative programming language. This might be a controversial choice as not many Python programmers recommend it if you ask for a good graphics library, but it is easy to use. Personally I'd have preferred Pygame as it would have been relevant later on when animation is introduced.

For any book trying to teach one subject via another the problem is always balance. In this case the math is fairly light and most of the book is about writing programs that draw interesting patterns or produce interesting behavior.

The book is in three parts and Part 1 is mainly about Python with a side order of turtle graphics. Turtle graphics is a well known way of getting students into math via programming. Chapter 1 is about drawing polygons with the turtle. Chapter 2 is about lists and loops and Chapter 3 is about conditionals.

Is the book addressing the potential teacher or the student? If the teacher then there should be some deeper knowledge passed on, but in the main the book avoids anything deep. For example, if fails to point out what makes turtle graphics important - a coordinate system that isn't fixed - and the way that this allows the student to learn to project themselves onto the object of the commands. 

 

Part 2 is about math, or rather, more about math than Part 1. Chapter 4 is on algebra, 5 on geometry, 6 on trig, 7 on complex numbers and 8 on matrices and their use in computer graphics. From a math point of view, there isn't a particularly coherent or logical trail.

For example the chapter on complex numbers introduces their basic operations and then jumps to the Mandelbrot set. It is fun, but for some it might be a bit hasty. Complex numbers are amazing and to go straight to the Mandelbrot set misses so many nice ideas. It also fails to put the Mandelbrot set in the fractals section which is where it should be. I also found the explanation of the equation that produces the set less than convincing. The iteration is usually explained as

zi+1=zi2+c

and it is c that is plotted with z starting off at zero - see The Programmer's Guide to Fractals. In this book it is z that is varied and plotted and the iteration is recast in code to be the equivalent of:

zi+1=zi2+z0

This isn't wrong but really doesn't bring out the usual way of thinking of what is going on, i.e. the orbit of 0 under the iteration for various values of c. What is worse, the change to the formula isn't explained and this is going to leave some readers wondering.

Overall my opinion of this part is that there are many opportunities to explain the math that are simply missed. Of course, if you dive in with heavy-handed, in-depth and hence potentially boring, explanations you might well drive the reader away, but I still think it's a little light on math.

Part 3 is called Blazing Your Own Trail and it's about a strange collection of topics. Chapter 9 is about object-oriented programming and the project is implementing a bouncing ball. This is more about programming than math. Chapter 10 is about fractals, but in fact it is more about recursion. Again missed opportunities to introduce math ideas and make connections with the earlier Mandelbrot set.The final chapter goes well off topic and describes genetic algorithms as a way of solving the travelling salesman problem.

A verdict?

You can tell that I'm not that positive about the book but mainly because of the missed opportunities to present the math - but you might disagree and be its ideal reader. The book is much more about writing math and graphics-oriented programs as ways of encouraging the reader. There are a lot of examples and, with some supervision, it would be a good source of projects for a math or computer science class. The math takes a back seat to the projects themselves, but this isn't necessarily a bad thing for the right reader. It might spark an interest that wasn't already there.

 

 

  • Mike James is the author of Programmer's Python: Everything is an Object published by I/O Press as part of the  I Programmer Library. With the subtitle "Something Completely Different" this is for those who want to understand the deeper logic in the approach that Python 3 takes to classes and objects.

 

For I Programer's recommendations of Python books see Python Books For Beginners and Books for Pythonistas in our Programmer's Bookshelf section. 

 

To keep up with our coverage of books for programmers, follow @bookwatchiprog on Twitter or subscribe to I Programmer's Books RSS feed for each day's new addition to Book Watch and for new reviews.

Banner


Modern Software Engineering (Addison-Wesley)

Author: David Farley
Pages: 256
ISBN: 978-0137314911
Print:0137314914
Kindle: B09GG6XKS4
Audience: Software Engineers
Rating: 3.5
Reviewer: Kay Ewbank

This book is subtitled 'doing what works to build better software faster' - does it teach you how to achieve that?



C# Programming, 3rd Ed (In Easy Steps)

Author: Mike McGrath
Publisher: Easy Steps
Date: April 2022
Pages: 192
ISBN: 978-1840789737
Print: 1840789735
Kindle: B09WPBZZCV
Audience: C# developers
Rating: 5
Reviewer: Mike James
An easy guide to C# - what could be better.


More Reviews

<ASIN:1871962587>

 

Last Updated ( Tuesday, 02 April 2019 )