### The SAGE Computer Algebra System

For a long time I've been struggling with the following problem. When you start working with a certain Computer Algebra System (CAS), you spend a lot of time becoming familiar with it, adjusting it to your preferences, writing your own functions etc. Because of this, you automatically trap yourself into using one and only one CAS for most purposes, and with time it becomes increasingly difficult to switch to any other CAS. Therefore this choice, this decision about which CAS I would "go for", became a very important one for me.Unfortunately it is not only very important, but also very difficult. There are many CAS out there, each of them with their own particularly attractive features. Mathematica and Maple, for instance, have a huge user base, and Axiom works with structures that are very closely related to mathematical structures (e.g. categories). In order to make the right choice, an obvious strategy is to make a list of features that can not be compromised on. Of course this is very difficult because typically you only discover what is essential when you find yourself in the position of lacking it. A rather hopeless situation if you, like me, have a relatively limited experience with CAS.

About half a year ago I became acquainted with a CAS that tries to be something distinctively different from the rest, and it is called SAGE. For short, it is a free multi-purpose CAS with a strong interaction with other existing CAS. It is mostly this "strong interaction" that solves my problem, and in my opinion it is a revolutionary piece of software that deserves to be better known. Therefore I will try to give an overview of the features and design decisions of SAGE that make it the best option that I can use and contribute to. Before this large post scares you away, let me remark that you can try SAGE in your browser (at least in Firefox, Safari and Opera).

### So what is SAGE?

SAGE aims to be the following:

- A
*complete self contained*distribution of*free open source mathematics*and other special-purpose software for*Linux, OS X, Microsoft Windows*, and*Solaris*. - A
*new library of functionality*to fill in the many gaps in functionality in existing CAS. That is, new implementations of algorithms that are generally missing in other CAS. - A
*collection of interfaces*to most other mathematical software systems (both free and commercial), bringing all these CAS*under the same roof*.

For a CAS whose development started in early 2005, the results are amazing. This is a direct consequence of this third point, of the idea to let SAGE borrow functionality from other existing CAS. Therefore SAGE developers like to say that they don't reinvent the wheel, but build the car.

Figure 1: Don't reinvent the wheel. (Image created by Martin Albrecht.)

### Free software and mathematics

Long term followers of this blog know that I am generally a proponent of free software and open source. As I mentioned for instance in my post on Granule, I strongly prefer working with free software when there is the chance to contribute something back to the project, which is almost always the case.

Furthermore I believe that free software projects have the most potential in the long term. Linus Torvalds, initiator of the Linux kernel, said something sensible about this:

I think, fundamentally, open source does tend to be more stable software. It's the right way to do things. I compare it to science vs. witchcraft. In science, the whole system builds on people looking at other people's results and building on top of them. In witchcraft, somebody had a small secret and guarded it -- but never allowed others to really understand it and build on it.

Traditional software is like witchcraft. In history, witchcraft just died out. The same will happen in software. When problems get serious enough, you can't have one person or one company guarding their secrets. You have to have everybody share in knowledge.

Apart from these general reasons to work with free software, there are some special reasons in the case of mathematical software. In particular, some people think that a mathematical result obtained from a CAS can only be accepted if it comes from an open source program. Already in 1993, Joachim Neubüser, who initiated the free software CAS GAP in 1986, made the following interesting remark:

You can read Sylow's Theorem and its proof in Huppert's book in the library [...] then you can use Sylow's Theorem for the rest of your life free of charge, but for many computer algebra systems license fees have to be paid regularly [...]. You press buttons and you get answers in the same way as you get the bright pictures from your television set but you cannot control how they were made in either case.

With this situation two of the most basic rules of conduct in mathematics are violated: In mathematicsinformation is passed on free of chargeand everything is laidopen for checking. Not applying these rules to computer algebra systems that are made for mathematical research [...] means moving in a most undesirable direction. Most important: Can we expect somebody to believe a result of a program that he is not allowed to see?

David Joyner, professor at the United States Naval Academy and long term contributor to SAGE, formulated this second point as follows:

A result computed by a computer algebra system, whose source code is not "open source", can not be accepted as part of a mathematical proof. Within the general mathematical community, it seems fair to say that a mathematical truth is not a theorem unless its proof is written down for public scrutiny (i.e., "open source") and generally accepted as correct. Just as to verify the correctness of a theorem you can go through the proofs of all the results your theorem depends on, one should be able to verify the correctness of an algorithm by reading the programming code of all the algorithms your algorithm depends on.

Moreover, a typical feature of the mathematical community that uses a CAS, is that a very large part of it is a potential contributor. Such a contribution could be reporting a bug and making a patch, requesting a feature, improving an algorithm or its implementation, or improving the documentation. The possibility to contribute back, to be more than just a user, is an attractive feature for a CAS.

To fully benefit from such an eager audience, one should

*make it easy for them to contribute*. That is, one should give them direct access to the source code. In SAGE this is achieved by just typing the command followed by two question marks, for example

`plot??`

, and this results immediately in a box with the source code of the function (though at the moment this only works for native SAGE functions, and it doesn't give you the source code of a function that can be reached through an interface to, say, GAP). Because of these reasons, I find the CAS being free software not something that can be compromised on.### Interpreter versus compiler

William Stein, founder and leader of the SAGE project, explains his choice for using Python and Pyrex in the SAGE Programming Guide better than I can:

Every serious computer algebra system, e.g., MAGMA, PARI, Mathematica, Maple, GAP, Singular, etc., is implemented as a combination of compiled and interpreted code. For Mathematica, Singular, MAGMA, and PARI, most of the implementation is in compiled C (or C++) code; some of these systems tend to be very optimized (subject to the constraints of the algorithms they implement). In contrast, Maple and GAP have a relatively small compiled "kernel" that defines the underlying programming language; most of the system is then implemented in this language. If you do benchmarks you'll discover that Mathematica is much faster than Maple at some basic operations. Likewise, benchmarks reveal that MAGMA is often faster than GAP.

This fusion of interpreted and compiled code is extremely natural for mathematics software; some algorithms are much better implemented in an interpreter because all time-critical steps involve low level arithmetic -- other algorithms, e.g., matrix multiplication, must be implemented in a compiled language in order to perform optimally. Also, existing compiled libraries are sometimes of very high quality, and a compiled language is needed to create the best possible interface to such libraries. It's crucial that both approaches to programming be fully supported. When deciding how to implement SAGE, I searched for months for an environment that could support both approaches. Python and Pyrex provide exactly this in a way that I believe is much easier conceptually than the implementation models of any of the other systems mentioned above.

Personally I love Python, and I couldn't think of any better choice for a scripting language. At the moment I am programming in R for a course in applied statistics that I'm taking. Although it is a wonderful and amazingly complete free statistics environment, its scripting language cannot compare to Python, and I find myself longing for the transparent syntax and list comprehensions in Python. It is only a matter of time before there is also an interface between R and SAGE, combining the functionality of R with the power of Python.

### A smart interface

The ordinary SAGE interface is built around IPython. This is a Python interpreter with a pleasant command line that features for example command line completion, which is very convenient for saving time on typing and remembering long function names. Strictly speaking, instead of

*function*, the term

*method*would be more accurate, because the command line completion yields only the methods within the class you are looking. Typing for instance

`set.[tab]`

, yields all the methods for the object `set`

, like `intersection`

and `union`

.This naturally leads to an obvious advantage of using an object oriented language like Python: it prevents the global name space from becoming polluted with thousands of very specific functions, making it almost impossible to find the function you're looking for and making it easy to confuse the context in which a certain function operates. Instead, each method is associated to the type of object on which it acts. For example,

`set.union`

acts on sets. That being said, some functions can still be called from the global name space, allowing one for instance to write `sqrt(a)`

instead of the rather awkward `a.sqrt()`

.Now most modern CAS have, besides the command line, some kind of a graphical user interface. This makes it easier for users to get started, enables users to work more conveniently with graphical objects and multi line input, and displays formulae in a more readable form. For a CAS, the usual form of such a GUI is a

*notebook*, which is basically a graphical representation of text cells, input cells, output cells and a menu system. An amazing feature of SAGE is that its notebook is not a stand-alone application that runs directly on your system. Instead, it is a web application that runs in your browser and uses AJAX technology to feel like a stand-alone application. This way anyone with a decent browser and an internet connection can try SAGE by surfing to an internet site that runs SAGE. Alternatively, you can run the notebook on your own computer by typing

`notebook()`

in your SAGE shell, and surfing to http://localhost:8000 in your web browser. This notebook, I think, is what will attract most users to try out the program in the first place. The fact that it is free software and can be used just by surfing to a website, gives it an accessibility commercial software can never offer.Moreover, the notebook uses jsmath to display formulae, and if you have installed true type fonts on your computer the result looks as if it were coming from TeX. Calling the function

`latex`

to an object, will give you in most cases the code for rendering it in your TeX document.Figure 2: The SAGE notebook.

### Smart documentation

Analogously to the source code, the documentation of a function can be reached by typing a command and one question mark, for example

`plot?`

. In a way typical of Python (and e.g. Java), such documentation is automatically generated from the source code. There is a rather specific template this documentation should adhere to, containing a one-line description of the function, the input, the output, examples, notes, references and authors. Apart from providing a very useful tool to *keep track of the documentation*, the examples can be

*automatically tested*. Because of the nature of SAGE as combining different CAS, each of them complex by themselves, tools for testing for bugs are essential, and this is a rather ingenious way to deal with an ever growing more complex interaction of pieces of code. On the other hand, this ensures that the examples in your documentation are correct.

Apart from this smart way of dealing with reference documentation, SAGE has a convenient way of presenting other documentation. By clicking on the

`edit`

-button in the notebook, you can edit the source code of the notebook. The possibility of inserting HTML outside the input cells, gives you a way to present a tutorial, a how-to, or any other type of documentation in an interactive way. A user can then play around with the examples you give in the tutorial, and absorb the information quicker than he would have been able to with a static tutorial. Of course such interactive notebook tutorials are not by any means new, but the fact that you can take them from anywhere with a decent browser and internet connection gives it an accessibility that is unmatched.### Further reading

I collected a couple of links to places where you can find more information about SAGE, some obvious, and some maybe not so obvious. Enjoy!

- The main website of SAGE.
- An interactive tutorial.
- Static online documentation of SAGE.
- A recently updated webpage with a list of open source CAS together with a description.
- A directory with talks about SAGE.
- A recent talk about the social and technical status of the SAGE project.
- A Google Groups discussion group about the development of SAGE.

Labels: mathematics, SAGE

## 78 Comments:

Ha Georg,

That seems like a very useful piece (or maybe better: set) of software! I'll keep it in mind in case I find myself in the need of some powerful mathematical tools.

But euhm... a comparison to witchcraft? :S May the evil software burn or be witch! :P

Oh, check out http://wtvisser.home.fmf.nl/blog/. Not much there yet. Planning to, though ;)

Hi, Georg,

I've been looking at a variety of math packages for some time. I'm a nontraditional student, with no real finances for the sorts of applications used for math, so my options were to (a) break the law and use cracked industry-standard applications; or (b) use open-source applications which don't necessarily benefit from as much attention to user interaction as the likes of Matlab or Mathematica.

In my browsing of discussions about this category of applications, I very quickly and frequently came across discussions pitting one against the other, since the syntax is potentially quite different from one to the next, as well as functionality. The relatively high cost of entry (purchase, or learning curve, or both) makes experimentation with many packages harder than it might arguably should be.

Enter SAGE. It seems to address most or all of these concerns, as it can make use of those big commercial apps, or of the open-source apps, or both in the same notebook. Also, the normalization of syntax within the SAGE system makes syntax a more transparent consideration, prioritizing the math over the application. I think it will take off, and can't wait to see what comes from the project in the next few years.

Eager as I am, I unfortunately have relatively little math education. I've been slowly working on a math degree (initially a math/physics dual degree) for a while, shoveling classes in between taking care of a family and working. This necessitates some self-study, which I hope to start in earnest very soon (working with differential equations first, then...not sure what after that). I had landed on the idea that I could dual-purpose my self-study to the degree to which I could make it applicable to my day job, and thought about entering the data analysis field (I work for a global market and ad research firm which employs quite a few of these sorts of analysts).

This brought me to wondering if there were an interface to some statistical application, such as R (that you mentioned), for SAGE. That would be a huge boon for me personally. You mention in this post that this interface is likely eventual, with which I agree. And I bother to blather on like this to share in your excitement for SAGE, as well as to wonder if I might be able to help any effort you might be undertaking for building that link between SAGE and R.

Thank you for your write-up here. It was very useful and informative.

Daniel

Hi Daniel,

Thank you for your lengthy reply to my post about SAGE, I'm glad it proved useful to somebody.

As for an interface between R and SAGE, I don't plan to work on that because my field of interest is quite different (algebraic geometry and differential equations). You can find more information about writing an interface in the SAGE Programming Guide and the SAGE Tutorial. First steps for such an interface are made, as you can read on Google Groups.

Thanks again for your interest, and success with your mathematics study.

The same thing applies for computer languages. once you get used to one you tend to just stick to it.And this also influences the computer world as far software is concerned. if you look back to microsoft's early begining you will realise that they where stuck to basic even though there where better languages out there that were far superior.

I could not agree more. It took me a long time as well to get away from BASIC and to start using more serious languages (first MSX-BASIC and later QuickBasic).

Hi Georg,

It is very useful information to me. But where or how can I get the informations about SAGE.

Hi Georg !

Over the last few years, I have become used to the Physics Package of Maple which enables one to use bras, kets, annihilation operators and other objects for Physics. Is it possible to get equivalent definitions in Sage for Physics field theory variational calculus etc ?

Any leads ? Please send me some links!

Thanks

Radhakrishna email : drradhak@runbox.com

Hi Radhakrishna!

I took the liberty to forward your message to Sage Support, a discussion group that deals with questions like these. I don't think that there are many people working on such functionality right now, but it might be supported through one of its packages.

its very informative related to computer and algebra system.

it's a great information for me,,,,thank's for useful article and keep share

oh man, I just hate algebra so much,butSage is so different..reallyit makes me feel its fun software

I found sage very interesting.

Plastic Card

This comment has been removed by a blog administrator.

This comment has been removed by a blog administrator.

Very nice post. I like your post very much.

SEO Company New York

SAGE computer algebra system is so great and contains a great technical assistance.Many thanks for sharing this appreciated information.

Thanks,

samuel

Appetizer recipes

beef recipes

hi..Im student from Informatics engineering, this article is very informative, thanks for sharing :)

Really your blog is very informative to us keep posting great information like this.

Great information you have posted through this blog keep posting like this..

Computer Algebraic system really difficult even some students do not know a single thing about it. As it is based on math so it is interesting also if student can understand the things.

math course online

This information you provided in the blog that was really unique I love it!!, Thanks for sharing such a great blog..Keep posting..

JAVA Training in Chennai

This information you provided in the blog that was really unique I love it!!, Thanks for sharing such a great blog..Keep posting..

SAP Training in Chennai

Its really nice and informative blog..Thanks for sharing this..

SAP Training in Chennai

Its really nice information..

Oracle Training in Chennai

I think its a nice post . Integrate your life with calculus by us at:calculus tutor

Its really very nice post..Keep posting..

Salesforce Training in Chennai

Thanks for sharing this nice blog...

Digital Marketing Training in Chennai

Thanks for sharing this useful information...

Web designing company in Chennai

PHP is an open source server-side scripting language specially designed for developing web application. Currently, about 80% of websites uses PHP. Thus PHP training in Chennai will guarantee enhanced career opportunity for aspiring professionals.

Thanks for sharing informative article on web design and development. Web development is a creative technology. Here, you need to use your imagination and creativity to create stunning website that are visually appealing and search engine friendly.

Best Web Designing Institute In Chennai

Your company developed new softwares according to projects and their nature of work. Only few companies are those are providing ERP type module based softwares. Appreciate your software development.

Thanks for this wounderful sharing.Hadoop training in chennai

Your company developed new softwares according to projects and their nature of work.Thanks a lot.hadoop training in chennai

Wonderful blog & good post.Its really helpful for me, awaiting for more new post. Keep Blogging!

Final year projects in Chennai

wounderful blogs!!!hadoop training in chennai...Very great information....

Thanks for that.Besant training...Very nice article...sap training chennai

Hi,i have to learn lot of information.thanks for that...You have to sharing for wounderful blogs!!!hadoop training in chennaihadoop training in chennai

thanks for that.. i have to learned to lot of information....hadoop training in chennai

Really is very interesting, I saw your website and get more details..Nice work. Thanks regards,

Refer this link below,

javatraininginchennai

SAP ABAP from beginner level to advanced techniques which is taught by experienced working professionals. With our SAP ABAP Training in Chennai you’ll

learn concepts in expert level with practical manner.

Besant Technologies

sap-abap-training-institute-in-chennai

This comment has been removed by the author.

We are the best providers of SharePoint Training in Chennai with experts. Our training program is very much mixed both practical and interview point of questions.

sharepoint-training-institute-in-chennai

Besant Technologies Reviews & Besant Technologies Complaints,

reviews-complaints-testimonials.html

Our Android Training in Chennai aims to teach beginners and

employees.Android is the fastest growing smart phone OS in the world

today..To know more,follow the below link

http://www.androidtraininginchenai.in/#

This is Valuable information for who wants to learns software courses, thanks for sharing.

Besant Technologies

&

QTP Training in chennai

Our Android Training in Chennai aims to teach beginners and employees.Android is the fastest growing smart phone OS in the world today..To know more,follow the below link

Best android training in chennai

best oracle apps hrms training in chennai

oracle apps hrms training in chennai

&

<a href="http://www.besanttechnologies.com/training-courses/oracle-applications-training/oracle-apps-hrms-training-institute-in-chennai>oracle apps hrms training institute in chennai</a>

Thanks to review,

Best ios training institute in chennai

Besant Technologies complaints

This page is dedicated for our Besant Technologies Reviews and Testimonials by our students. Please give your reviews here,

Besant Tech Review

Oracle 11g Release 2 RAC & Grid Infrastructure Administration course provides an introduction to the general features and capabilities of Oracle Real Application Clusters (RAC) within the Oracle Grid Infrastructure environment.

Oracle DBA Training Chennai

This page is dedicated for our Besant Technologies Reviews by our students. Please give your reviews here,

Besant Technologies Video Reviews

SAGE Computer Algebra System are really amazing and very informative post.

crack software download website

all new software download free with crack version.

SAGE Computer Algebra System is a wonderful technology. very nice post!

new update software

The SAGE Computer Algebra System is very useful and informative article. thanks for nice post.

full crack software download site

That's amazing thinking about computer knowledge ..... Sage is too much amazing...

CRACK SOFTWARE DOWNLOAD | FREE DOWNLOAD

This is very hard to understand this sage algebra.... explain it in easy ways....

Crack Software Download | Free Download Software

The SAGE Computer Algebra System is really a great informative article. thankful for this sharing.

full version crack software

The SAGE Computer Algebra System is really informative and useful sharing.thanks for nice posting.

Download Free Software

Thanks for nice posting! The SAGE Computer Algebra System is really informative and useful.

Portable Software Download

Thanks for sharing this valuable information.and I gathered some information from this blog. I did SAP Training in Chennai, at FITA Academy located which offer best SAP Course in Chennai with years of experienced professionals.

Really awesome blog. Thanks for sharing this informative blog. Suppose if anyone want to learn Software Testing Training Chennai at a reputed training institutes. If you are looking for best Software Testing Training Institute in Chennai reach FITA located at Chennai, India. Rated as No.1 placement and training center in Chennai.

Really awesome blog. Thanks for sharing this informative blog. Suppose if anyone want to learn Software Testing Training Chennai at a reputed training institutes. If you are looking for best Software Testing Training Institute in Chennai reach FITA located at Chennai, India. Rated as No.1 placement and training center in Chennai.

Thanks for sharing this informative blog..If anyone wants to get SAP ABAP Training in Chennai, please visit FITA Academy located at Chennai, rated as No.1 SAP Training Institute in Chennai.

Hi I am Emi lives in Chennai. I am a technology freak. Recently I did Java Training in Chennai at a leading Java Training Institutes in Chennai. This is really helpful for me to make a bright carrer in IT industry.

Thanks for your wonderful post.It is really very helpful for us and I have gathered some important information from this blog.If anyone wants to get Dot Net Training in Chennai reach FITA, rated as No.1 Dot Net Training Institute in Chennai.

Thanks for sharing this information. SEO is one of the digital marketing techniques which is used to increase website traffic and organic search results. . If anyone wants to get SEO Training in Chennai visit FITA Academy located at Chennai. Rated as No.1 SEO Training Center in Chennai.

Its really awesome blog..If anyone wants to get Software Testing Training in Chennai visit FITA IT academy located at Chennai. Rated as No.1 Software Testing Training Institutes in Chennai

The information you posted here is useful to make my career better keep updates..I did Salesforce Admin Training in Chennai at FITA academy. Its really useful for me to make bright future in IT industry.

I have read all the articles in your blog; was really impressed after reading it. If anyone focuses the Best sap training in Chennai. Let us know we are ready to serve for your career. FITA is pleased to inform you that; we provides practical training on all the technologies with the MNC exports having more than 5 years of experience in your preferred domain. Get your career with our knowledge.

SAP ABAP Training In Chennai|SAP MM Training In Chennai|SAP SD Training In Chennai

Thanks for splitting your comprehension with us. It’s really useful to me

PHP Training in Chennai

Android Training Institute in Chennai

Your blog is really useful for me. Thanks for sharing this useful blog..Suppose if anyone interested to learn Android Course in Chennai please visit fita academy which offers best Android Training in Chennai at reasonable cost.

Android Training Institutes in Chennai

HTML5 Courses in Chennai

Hi, Thanks for sharing this valuable blog.I was really impressed by reading this blog. I did HTML5 Training in Chennai at reputed HTML5 Training Institutes in Chennai. This is really useful for me to make a bright future in designing field.

Best HTML5 Training in Chennai

Its really awesome blog..If anyone wants to get Software Testing Course in Chennai visit FITA IT academy located at Chennai. Rated as No.1 and Best Software Testing Training Institute in Chennai

Regards.....

Software Testing Training

Hi, I wish to be a regular contributor of your blog. I have read your blog. Your information is really useful for beginner. I did Software Testing Course in Chennai at Fita training and placement academy which offer best Software Testing Training in Chennai with years of experienced professionals. This is really useful for me to make a bright career.

Regards...

Software Testing Training Institutes in Chennai

Thanks for sharing this valuable post to my knowledge great pleasure to be here SAS has great scope in IT industry. It’s an application suite that can change, manage & retrieve data from the variety of origin & perform statistical analytic on it, if anyone looking for best sas training in Chennai get into FITA…

sas training institute in Chennai | sas training chennai

Unix Training

Thanks for sharing this informative blog. Suppose if anyone interested to learn Unix Training in Chennai, Please visit Fita Academy located at Chennai, Velachery. Rated as No.1 Unix Training Institutes in Chennai

PHP Training Chennai

I get a lot of great information from this blog. Thank you for your sharing this informative blog. Recently I did PHP course at a leading academy. If you are looking for best PHP Training Institute in Chennai visit FITA IT training academy which offer real timePHP Training in Chennai.

PHP Course in Chennai

Post a Comment

<< Home