You are here

An Introduction to SAGE Programming: With Applications to SAGE Interacts for Numerical Methods

Razvan A. Mezei
John Wiley
Publication Date: 
Number of Pages: 
[Reviewed by
Glenn Becker
, on

I was pleased to see this book appear. I’m a great fan of the Sage project and its goal of “Creating a viable free open source alternative to Magma, Maple, Mathematica and Matlab,” so any book that seems to further those goals is a welcome sight.

Sage includes a browser-based “notebook” interface that builds on Python’s iPython/Jupyter system. The Sage Cell Server allows anyone with a browser to use the system. An “Interact” is a program written in this system that includes features — input boxes and sliders, for example — allowing a user to interact with it. Interacts have great potential.

Two initial reactions to this book:

1.Where was the copyeditor? This is a question I have grown hoarse asking. At the risk of sounding crotchety, I far too often encounter heaps of embarrassing and easy-to-spot mistakes in expensive books from distinguished publishers. Are copyeditors that expensive, or rare? I doubt it: I’m not formally trained, but I could have cleaned up the manuscript considerably.

2.The gaffes in this book are of varieties that make me believe English is not the author’s first language — which should have been even more reason to have assigned a good copyeditor to the book. I’m looking at you, John Wiley & Sons.

This book is far, far shorter than it appears. I have succumbed to and now grudgingly accept the fact that a slim book can merit a price tag of $74.95; however, consider the following issues with the book under consideration:

a.Repetitive graphics. Of course one wants illustrative graphics in a book about creating visual tools/widgets, but how many are really necessary? And do we really need graphics to illustrate every change? Including a black and white graphic to illustrate output color changes isn’t space well used! (See pp. 146–7)There are far too many graphics included to illustrate simple changes in the program output.

b.Overabundant exercises. Sure, exercises are great, but there are so many of them here! Chapter 4 begins with a very simple example of a Sage Interact (plot a line, and include sliders to let the user adjust slope and y-intercept), and is followed by a block of eight exercises, each of which asks the reader to alter or augment a previous example in a minor way. Surely three or four exercises would have been sufficient. In addition, large contiguous blocks of these exercises begin with the same text — for example, “Using a Calculus book as a guide, create a Sage Interact that ...”.

c.Entire code samples are repeated. Rather than present a code sample and then later discuss enhancements to the example by showing the new line(s) of code in bold font, with a few lines preceding and following the addition(s), entire pages of code are repeated verbatim.

Again, (c) would have been simple to avoid — but it isn’t avoided, and the result of all the needless repetition is that the book has perhaps one third of the content its page length suggests.

The author takes little time to actually explain, justify or illuminate much of anything. Programming is explained with examples, and the mathematics is largely relegated to references to other texts. This turns the book into a wisp from which it is very difficult to learn. The interest and utility of Sage Interacts is established in the present book’s Chapter 4, but I nearly gave up before I got there.

In summary, a longer, more detailed “Sage Interact Cookbook”-style text could work well, similar to the ones O’Reilly does for general-purpose programming languages like Python. Basic Sage and Python programming proficiency could be stated prerequisites, and the current set of examples near the end of Chapter 3 and for the bulk of Chapter 4 could be greatly expanded.

There is useful material buried in this slim book. One would think that a small haystack would make for easy-to-find needles, but that is not the case here. A good opportunity was lost in what seems like a hasty effort to get a book out.

Glenn Becker is a staff member at the Harvard-Smithsonian Center for Astrophysics in Cambridge, MA, where he toils in the data archive of the Chandra X-Ray telescope. He is a “reborn astronomy and mathematics fellow traveler” who spent far too many years getting advanced degrees in theater, only to ultimately abandon the entire discipline.

See the detailed table of contents in the publisher's webpage.

  1. Introduction
  2. Using Sage Math as a calculator
  3. Introduction to Programming in Sage
  4. Sage Interacts for Numerical Methods