## Sage 3.0.1 reviewed in LXF

During the previous weekend, I bought my copy of issue 109, September 2008, of Linux Format (LXF) magazine (dead tree version). Down under in Australia, we have to wait quite some time for overseas magazines to arrive. When they appear on the news stand at my local magazines store, the “latest issues” of Linux related magazines tend to be rather out of date — that is, if you don’t have subscriptions.

The September 2008 issue of LXF has a review of Sage version 3.0.1 on page 33, written by Will Tribbey. This review is part of the issue’s “Roundup” section (pp.30–35), which also reviews the Euler Math Toolbox (EMT), Matlab, Octave and Scilab. Unfortunately, I can’t yet find an online version of the Sage review at the official home page of the magazine, so you just have to be content with me quoting the review below:

## Sage

When the maths gets really serious.Sage is so much more than a numerical computing platform. Yes, it does numerics, but it also does symbolic computer algebra that makes it an extremely capable system for doing calculus and algebra but also research in cryptography, number theory, and graph theory, to name a few.

Sage takes a departure from the other platforms in this review in that it uses Python rather than having a programming language of its own. For some users this will be a significant attractor, since if you already know and love Python you won’t have to learn another language. From the performance checks using the SVD and FFT, Sage (using Python’s Numpy Library) was comparable to Scilab and Octave, while the SVD test was blazingly fast — faster than Matlab by a significant margin.

Sage is a relative newcomer to this group but it does make use of software that started many years ago. Take Maxima for instance. Maxima has as its ancestor the Macsyma computer algebra system initially developed at the Massachusetts Institute of Technology in the late 1960s. Maxima and other components make Sage an eclectic mix of mathematical software.

It’s all about sharingOne laudable goal of the Sage project is to enable the convenient sharing of mathematical ideas, and one way it does this is through the use of web-based notebooks. You can enter commands into the console provided by the Sage web application and then evaluate them. It really is like writing a math notebook online. Your notebooks can be saved and shared, which has many positive implications for teaching and research collaborations. You can try Sage without having to build or install it by going to www.sagenb.org, signing up for a free account and writing your own notebook.

[Image featuring a Sage notebook session and a 3-D plot. The caption reads: “The graphics in Sage normally display in a Java applet inside the page. So much for the bleeding edge…”]

The notebook in the image shows the following code:

`sage: u,v = var('u,v')`

sage: fx = (3 + sin(v) + cos(u)) * cos(2*v)

sage: fy = (3 + sin(v) + cos(u)) * sin(2*v)

sage: fz = sin(u) + 2 * cos(v)

sage: P = parametric_plot3d([fx, fy, fz], (u, 0, 2*pi), \

....: (v, 0, 2*pi), frame=False, color="red")

sage: show(P)

which was used to produce the 3-D plot below:

LXF gives the following ratings:

EMT: 5/10 Matlab: 9/10 Octave: 7/10 Sage: 6/10 Scilab: 9/10

Sage comes out in fourth position out of the five systems reviewed. Its relatively low rating is not due to its lack of support for numerical computing, although it must be noted that the primary focus of Will Tribbey was that area. As far as I understand, the tests had nothing to do with symbolic capabilities of the five targeted systems. Only Sage is praised for its symbolic capability as well as not inventing its own programming language. Page 35 concludes:

Sage and the Euler Math Toolbox were only included as a matter of diversity and choice, since one person’s numerical nirvana is usually another’s sixth circle of hell. We were therefore pleasantly surprised to find Sage a worthy contender not only for numerical computing but for doing symbolic computing too. It stood out as the only platform to make direct use of an existing programming language, Python. Since you can directly create mathematics documents on the web with Sage, don’t be surprised if maths blogging becomes the next cool thing on the internet. And remember, you read it here first…

The evaluation of EMT, Matlab, Octave, Sage and Scilab were conducted with these factors in mind:

- ease of installation
- user interface
- documentation
- community support
- available toolboxes

Matlab was held to be the “gold standard” (an expression by the reviewer) against which the other four systems were measured.

A recurring theme throughout tests on the above five systems was the issue of algorithmic performance, as measured “by computing the singular value decomposition (SVD) and fast Fourier transform (FFT) of a 500×500 real-valued matrix 100 times and calculating the average and standard

deviation of those 100 trials” (p.30). On page 31, we have the following performance evaluation:

Performance is one area where Matlab had difficulty maintaining a commanding lead. For the SVD test — an important matrix decomposition in many statistical and numerical algorithms — Matlab performance was slightly more than 20% better than Scilab and Octave. The surprise was that the Numpy algorithm used from within Sage was on average over 250% faster than Matlab. It’s not included in this Roundup, but this performance difference indicates that the Numpy library for Python deserves a closer look when performance matters. Matlab comes out the winner in the fast Fourier transform.

In the end, Scilab comes out with a score of 9/10. Matlab has the same score: “[Matlab’s] score was taken down because of its cost” (p.31). As to why — as a contender against Matlab — Scilab is ahead of EMT, Octave and Sage, Will Tribbey’s reasons can be summarized as follows:

- the large number of toolboxes
- visual system modelling (the Metanet toolbox) and simulation (the Scicos toolbox)
- the number of built-in functions
- a Matlab IDE-like command window for developing and debugging functions

You can follow the discussion of Will Tribbey’s review at sage-devel.

## Magent for year 10 maths

I’ve been working with Mohammed Mastan on a team based software engineering project that involves designing and implementing an agent oriented game. The game is required to use techniques from agent oriented software engineering (AOSE). One of the goals of this project is to learn about AOSE techniques and applying some of them within a small software project. Another goal is to teach mathematics to Year 10 students within Victoria, Australia, although I doubt that others will seriously use it for that purpose.

Today, Mohammed and I delivered a presentation on an early prototype of our project. During the presentation, I used a set of notes and visuals to elucidate and elaborate on our ideas, and to give some sense of direction of where we’re going with the final version. Mohammed talked about the database aspect of our project. I’m not sure he has prepared presentation slides to distribute to anyone who’s interested in getting them, since he’s a very busy person. So far, working with Mohammed has been a positive experience. He has humbled me with his professional knowledge of database and database management.

There are various open source projects that concentrate on developing a set of libraries and APIs for building applications using agent oriented techniques. JADE and Jadex both use Java in developing their respective functionalities. Both of these packages are pretty functional at the moment, while it should be stressed that Jadex was originally (and still is) a research project.

Currently, we’re using Python to implement our game. I’m trying to integrate Brent Burley’s Python implementation of reversi into our game. Burley’s Python implementation is useful for what we’re doing, and its basic artificial intelligence for the computer player is sufficient for our small project. Being a database expert, Mohammed is concentrating on the database aspect of our project, in addition to doing many of the design work. He has looked into using Python’s interface to SQLite. From our discussion on this issue, it looks like we’re going ahead with using this library for our database engine. Before version 2.5, Python didn’t have support for SQLite. With the release of Python 2.5.x, and version 2.6.x, it’s now rather painless to get a Python program to communicate with a lightweight database engine.

Our project code name is “Magent”. The “agent” part serves to remind us that we should use agent oriented techniques. The capital letter “M” can stand for many things: multi-agent system, mathematics, magnificentðŸ˜‰ , etc. Fingers crossed for our final version, everyone.

## Debian 5.0 Lenny official beta

For the last few hours today, I’ve been playing around with Debian 5.0 Lenny (official beta). The installation process has improved greatly since my last installation back in 2006, especially the graphical installation option. The graphical installer is quite intuitive — at least to someone with some experience installing various Linux distributions.

Another nice feature about the graphical installer is that it allows you to produce screenshots while you’re installing. The option to produce screenshots is marked with a button called “Screenshot”. All screen captures produced are saved to your disk in

`/var/log/installer/`

or thereabout. This is a good thing because it provides you with visuals to use if you’re writing tutorials on how to install various distros, in this case, Debian Lenny. On the other hand, the site linuxscreenshots.org provides loads of screenshots for such a purpose.

I have a box for everyday work and development, and another box for testing purposes. This doesn’t mean that I exclusively use the testing box for testing only. I do use it for everyday work as well. It is on the testing machine that I installed Debian 5.0 official beta, configured to dual boot with Fedora 9.

Installing the official beta version of Debian Lenny took less than an hour. That’s because in the “Software selection” screen, I only selected the options “Desktop environment” and “Standard system”. Plus the hardware I use is relatively fast, although it’s not a multi-core machine.

After successfully installing using the graphical installer, I was able to dual boot into both Fedora and my new Debian distro. Here’s a screenshot of my “Lenny” Gnome desktop:

More screenshots taken during the installation can be found in my web album.