Home | | Mathematics | | * Sage | | Share This Page |

Exploring Mathematics with Sage

**A free, open-source mathematical workshop**

(double-click any word to see its definition)

Introduction

To navigate this multi-page article:

Use the drop-down lists and arrow icons located at the top and bottom of each page.

Figure 1: printing press

Figure 2: typewriter

Figure 3: personal computer

Try to imagine the history of written communications if someone had claimed ownership over the printing press and refused to reveal its secrets in perpetuity. Obviously we could fall back on quill pens and parchment, but all the benefits of free written expression would be compromised and delayed.

As amazing as it may sound, there are several recent examples of people claiming ownership over basic instruments of intellectual expression. One of these is the history of Microsoft Corporation, owners of the Windows operating system. Fortunately for the role of technology in human affairs, Microsoft is about to be superseded by open source programs and operating systems, most notably Linux.

Open SourceObviously Microsoft has the right to sell its own products, but it doesn't have the right to stop competitors from adopting different strategies, or stand in the way of technological evolution. As it turns out, something called "open source" has overwhelming advantages over the Microsoft corporate plan, to the degree that at the time of writing, we are seeing worldwide adoption of open source programs and methods.

The basis of open source is the idea that computer programs should be readable and modifiable by anyone, sort of like free press rights in which people are at liberty to adopt and modify other people's ideas (while granting credit where credit is due). It's not immediately obvious how businesses can make money with the open source model — indeed we are witnessing a rather painful adjustment to the realities of open source. But the overall effect of open source has been a shift away from centralized control of technology to a much more open and transparent system in which many more people are allowed to participate and contribute — just as in the history of written communications.

This doesn't argue against commercial and profitable activities in computer technology, only that people will make money in a different way. Future technology companies will accept open source and offer support, training and expertise in new business plans that resemble science more than engineering.

An aside. Science works only because everything is out in the open, and the benefits of science spring directly from that openness. This has to do with a kind of efficiency that is unique to science and that depends on openness — bad ideas are quickly exposed, good ones replicated and improved, all due to the public nature of the process. And very important —

secret science is not science at all.Efforts to practice science behind closed doors tend to produce mediocre results or outright fraud.

Math by ComputerAs it turns out, today computer mathematics is in the position of computer software a few years ago, before the advent of open source — a small number of secretive, wealthy vendors of proprietary products, absurdly high prices, many dependent users of these products including scientists and engineers, and a complete absence of openness. And just as with general computer software, this is all about to change.

I have shown some parallels between computer mathematics and other applications of computer technology, but it's important to emphasize the differences. If we study biology using computers, knowing exactly how the computer works isn't very important because the computer can't realistically compromise the outcome. But if we study mathematics using a computer, it is

essentialto know exactly how the computer achieves its results. This springs from a basic difference between mathematics and other sciences — in mathematics we can and should demonstrate the validity of a result by exploring its foundations. Indeed without this ability mathematics would lose its rigor and standing among intellectual disciplines.Many mathematicians have argued that computers have no place in mathematics, that they compromise deep understanding of theorems and make mathematicians trust what may be incomprehensibly complex results. These are real risks, and the remedy is to make the computer's role in mathematics as transparent as possible. But computers have already produced many noteworthy results in mathematics, in spite of these cautions. Two early examples:

Calculus ErrorsIn the 1960s Melvin Klerer and Fred Grossman began

^{1}a computer project meant to automatically create and test Calculus integrals. Klerer and Grossman quickly discovered that many existing math textbooks seemed to be riddled with errors. Naturally enough, at first they assumed that the relatively new computer methods were the source of the errors, but exhaustive testing eventually revealed that the problem actually lay with the textbooks. In some published tables the error rates exceeded 25%.This was a shock for several reasons. Computers had until then been taken as a lazy person's substitute for mathematical rigor, and the textbooks being examined were seen as the unimpeachable product of highly regarded professional mathematicians. Further, engineers responsible for designing bridges and airplanes accepted the tables of equations without question (on the ground that engineering isn't science, it's applied science). This and similar results forced a reëvaluation of the role of computers in mathematics.

The Four-Color Map TheoremThe four-color map theorem asserts that a map may be successfully colored by at most four colors (so that different territories are distinguishable), but this idea withstood efforts at proof until 1976, when Kenneth Appel and Wolfgang Haken proved it using a computer. This was one of the first computer-assisted formal proofs of a mathematical theorem and it led to much controversy.

The controversy centered around the fact that the proof relied on a computer program that exhaustively tested all 1,936 members of a set of maps meant to represent all maps. Some argued that this wasn't a mathematical proof at all but an exhaustive test of all possibilities — an end run around a mathematician's presumed responsibility to produce a proof that concisely expresses general principles, and the more concise, the better. Others argued that only someone with knowledge of computer programming could possibly understand the proof.

Notwithstanding these reasonable objections, projects like the above have had the effect of changing attitudes toward the computer's place in mathematics, and more recently computers have come to be regarded as a sort of research assistant for pure mathematicians and an essential partner for applied mathematicians. But over time, the practice of writing small, openly published mathematical programs meant to solve specific problems has been replaced by large, proprietary commercial projects meant to address general problems in an efficient but opaque way. This is the basis for my comparison with Microsoft — companies like Wolfram Research, publishers of Mathematica, are to mathematics what Microsoft is to computer operating systems.

Figure 4: Sage graphic output

Figure 5: Sage graphic output

But the big players in the mathematical software field — Mathematica, Maple and a handful of others — are about to face the same challenge as Microsoft, and for the same reason: the clear advantages of open source. And in mathematics, the difference between open-source and closed-source is more important, for the reason that any part of a mathematical solution that cannot be fully examined is

fatal to the result.

MathematicaWhen I first used Mathematica years ago I saw a big improvement in my ability to produce useful mathematics, but I also wanted to use this new tool to improve my understanding of mathematical methods, not just acquire high-level results. I began to search for a way to make Mathematica show its internal process — for example, to reveal how it transformed a complex equation from one form to another, step by step. But a thorough search turned up nothing — Mathematica only produced results, with no hint about its methods. At the time I thought it odd that such a powerful program could accidentally omit something so important. I eventually realized this design was no accident.

The reason for the omission now seems obvious — Mathematica is only apparently a mathematical assistant. It's more accurate to describe it as a costly (US$3,000 in 2009) math martinet, a dispenser of results that won't brook disagreement or expose its methods. From a corporate perspective this seems perfectly reasonable, but from a mathematical perspective it is a fatal flaw — no one should expect to use Mathematica's results as part of a theorem, for the reason that a theorem dependent on Mathematica cannot be broken down to its essentials in the time-honored way.

SageAs it turns out, there are very promising and active open-source mathematical software projects. One recent project, the topic of this article, is Sage, a free, open-source project with international contributions and support. At the time of writing Sage is being actively developed and appears to have acquired a property one might describe as

critical momentum— it's attracting increasing attention and support from many who might instead work on independent projects of lesser scope.The basic goal of Sage is to provide for mathematics what Linux has provided for operating systems — a medium for free, creative expression, unencumbered by proprietary interests and restrictions. Not surprisingly, Sage runs most happily on Linux (but can be made to run on Windows). The entire code base of Sage is open and modifiable in the best tradition of open source, consequently Sage is accessible in ways programs like Mathematica cannot be.

ConclusionI don't want to mislead my readers — Sage is not Mathematica. There are many things Mathematica can do that Sage cannot (I provide examples in this article). But a Mathematica license costs about US$3,000 (2009) for unrestricted use, and for perhaps 95% of mathematical software users that's an unnecessary expense, or Mathematica's secrecy may be fatal to the task (e.g. when publishing both methods and results).

I sometimes hear young people say, "How can it have value if it has no price?" My reply is that much of reality contradicts this view and many valuable things are free (like mathematics). Finally, for those who take this position — whatever you do, don't let your sexual partner hear you saying it.To put this another way, Mathematica is a black box. If you only need a result, don't care how it was obtained and you have US$3,000 to spare, maybe Mathematica is the right approach. But if you cannot afford Mathematica or you need to know how a result was obtained, Sage may be a better choice. Finally, the existence of programs like Sage puts pressure on companies like Wolfram Research to reduce their prices, to realize there are alternatives and, just as with Microsoft vs. Linux, to rethink how they do business.

None of this is meant to suggest that Microsoft and Wolfram Research don't have the right to create and sell products to the best of their abilities, and both companies have products with admirable qualities. But they need to realize there are new players on the field.

Here are some Sage-related links:

- Sage Home Page
— overview, examples, support.- Sage Online
— log on to a live Sage session (free signup required).- Linux download:

- Sage
— installation archive.- Windows download:

- Sage
— installation executable.- VirtualBox (required for Sage on Windows)
— creates a virtual Linux environment to host the Sage server.- Live CD/USB (Linux or Windows):

- Download Options — download a Live CD image or a Live USB zip file.
These download options, and detailed installation instructions, are described in the pages to come.

References

Licensing

"Exploring Mathematics with Sage" by Paul Lutus is licensed under a

Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.

Home | | Mathematics | | * Sage | | Share This Page |