|Math Adventures with Python|
Author: Peter Farrell
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
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:
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.
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.
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.
|Last Updated ( Tuesday, 02 April 2019 )|