Book review: Sage Beginner’s Guide

I heard about Sage when I started learning Python, but I never quite gotten in the bandwagon. Now, this Beginner’s Guide seems a good place to start.

Content and opinions

As with a lot of (all?) Packt Publishing Beginner’s Guide, the book with a small introduction of what you can expect of the piece of software and its installation process on the three major platforms. Although for Windows the process is more complicated, the author gives the whole explanation, even on why the process is so complicated for this platform.

Sage consists of several layers, Python being one of them, but there are many others. The book tries to dig a little bit further each time. The first “real” (i.e. outside the introductory and installation) chapter tackles the two main ways of using Sage, the interactive shell and the notebook. The different options and the basic usage are explained and illustrated with a lot of examples. The next step is mastering basic Python, which also done with the same efficiency as before.

As Sage is mostly about math stuff, the book spends several chapters on the different APIs it offers to handle data. First, linear algebra and the different vectors and matrices are introduced, with a final reference to Numpy and its special arrays. Here is perhaps something lacking in this book: a reference to scipy. Indeed, scipy has a lot to offer in terms of linear algebgra, and it works with Numpy arrays. That being said, the common linear algebra issues will be solved by the Sage interface directly.

A huge topic is graphics and scientific plots. The book exposes the different aspects of graphical Sage and also its main support package matplotlib. 3D graphics are also tackled, also they are only very recent in their current form in Matplotlib. It’s a good surprise to see some examples here.

From my point of view, the purpose of the whole book is the seventh chapter with the subject of symbolic math. The mathematical kernel can handle a lot of different input, rational numbers, trignometric expression, algebraic expressions, derivatives, integrals… Everything the Sage framework can handle is exposed. Also, if there is something it cannot directly handle, Sage can use numerical expressions to solve the issue (the eightth and final math chapter).

The last two chapters are not on Sage directly, but more on Python and scientific publications. The Python programming chapter uses a war metaphor, and I guess there might have been another better and more adequate subject for Python programming. If you are used to Python, you may skip this one. The last one is about scientific publication, and eventually the optimization. This last topic is only touched, but it is given the necessary attention given the depth of Sage capabilities.

Sometimes the book feels like a giant dictionnary of all the things you can do with Sage, and it actually is. And to find something, you may only have to browse the table of contents and get to the part you sought.

Conclusion

Sage is an extraordinary beast, with pieces coming from a lot of different projects, and it’s always difficult to know which project you are actually using. Sage acts like a wrapper for most applications, but once you need more, you can tap into the power of each subpackage. The book helps this process, with a good overview of Sage and a lot of real examples. There are some typos inside the book, but they are easily spotted if you mastered the previous chapter.

As for the last Packt Publishing review, I’d like to thank the publisher for sending me this book. You can of course find it directly on their website.

Leave a Reply