March 5, 2013

Doing mathematics on the computer in Sage
"Mathematics is concerned only with the enumeration and comparison of relations."
-- Carl Friedrich Gauss


1. Doing mathematics on the computer in Sage
About ME/CFS


I keep having trouble with my eyes - keratoconjunctivitis sicca - and therefore this is again only a brief Nederlog. And as you may have noticed, I kept changing the subjects the last days, and I am doing so again, today.

This time my subject is mathematics, by computer, and if you are not interested in mathematics or programming, this is not for you, and there probably will be another subject tomorrow.

1. Doing mathematics on the computer in Sage

I like mathematics and I can program and therefore - one might think - doing mathematics should be a whole lot easier on computers. The answer is yes and no, and mathematicians seem to be divided about it too. Here is an interesting reference - if mathematics and programming interest you - namely

by Natalie Wolchover, who writes

Anyone who relies on calculators or spreadsheets might be surprised to learn that mathematicians have not universally embraced computers.

Part of the problem is mostly this, as she writes:

Computers are now used extensively to discover new conjectures by finding patterns in data or equations, but they cannot conceptualize them within a larger theory, the way humans do. Computers also tend to bypass the theory-building process when proving theorems, said Constantin Teleman, a professor at the University of California at Berkeley who does not use computers in his work.

Others differ, and indeed it is difficult to see why one cannot, in principle, put a lot of theory in software. Then again, software may be bugged in all manner of subtle ways, and the problem with results generated by a computer that one cannot verify mentally or by hand, with paper and pencil, is that one has to take it on faith - though this might be overcome or lessened when different programs working on the same probloem arrive at the same result.

In fact, there are some theorems that depend on computers. The most famous is the proof of the

that you find well explained on Wikipedia by way of the last link. There are some others, but it seems by and large computers are mostly used - so far - in pure mathematics to generate data and find patterns.

It turns out that there is interesting and useful set of free and open source programs collectively called

  • Sage (<- Wikipedia)

Apart from its being free and open source, part of its strengths are that it comprises a lot of other free and open source mathematical software; that it is (mostly) based on Python, which is a clear, elegant and easy to learn programming language (that is not needed for using Sage, but helpful if one uses it); that it can do a whole lot of mathematics and graphing - algebra, geometry, differentiating, integrating, matrices, groups and more - and quite elegantly too; and that one can use it in a web browser, preferably Firefox (maybe others, but Firefox is my main browser anyway, so I did not look further).

In case you are interested, here are some helpful links - with one proviso: I only know this from Linux.Ubuntu, and not from Windows or Mac on which it also can run.

First, there is the the Sage project's site

with a lot of documentation, videos and also

There are various tutorials and videos explaining it, but I found the following one, by a user of it, quite helpful - and I provide a link to the first of a series of 11 files, that explain what it is, how to get it, and how to work with it:

This is all well done, as is the second in the series, that explain how to get it

I followed the Installation instructions that the last link provides for a version available in 2009. This works, but in 2012 there are a few gotchas:

  • the download of the latest version is almost 500 MB
  • one needs at least 3 GB free to install it
  • I downloaded from a British site that added an lmza compression
  • it was explained on the site how to unpack this (on Linux) and indeed that worked, but
  • the above Installation and Testing are formulated for the Linux terminal but on Ubuntu one can use the file manager and the archive manager as well, and faster, although
  • I do start Sage from a terminal (and the above link gives explanations how to make a startup file for one's desktop)

It all worked as promised, though one should not forget to enable JavaScript for the Notebook version that runs in Firefox, which is quite neat. I think this is the best way to run it, but it is pleasant one can also run it in a terminal aka virtual console - which thereby becomes an extremely powerful calculator, at the very least.

I find it all quite impressive and useful, and an excellent example of what free and open source can achieve - in which context I will end with three remarks.

First, there are commercial programs - not free and not open source - such as Magma, Maple and Mathematica that are - said to be - as powerful as Sage. The price is several thousands of dollars for one such program, with the practical certainties that one cannot see their source, and that they are developed by far fewer persons. (Besides, this is not helpful for those who do not grow money on their backs, such as students, whether in universities or high schools.)

Second, I have played a little with Mathematica and Maple, long ago, and could get less done with them then than I could with Sage now, though that probably is due to the passage of time or to my personal tastes and limitations.

Third, while I have used spreadsheets some, I generally have done mathematical things in some programming language I know, mostly in Smalltalk, JavaScript or Python, because that tended to be easier and more versatile for me, but my guess is that such mathematics as I do will be easier in Sage, because it was built for it, and one can use Python in it.

So... if you are interested in mathematics, you should check out Sage. And in case you are learning mathematics: I am sure I would have loved this as a teenager, and would have been helped a lot by it, because it is fast, powerful and has excellent graphics, and also it seems a lot smarter, kinder and more capable than my teachers of mathematics. [1]

[1] None of whom was a mathematician: They were former merchant marines, who were allowed to teach mathematics, which was a profession that only served their interests and not the interests of their pupils. (But in the early sixties pupils were supposed to obey, also if, as in my case with mathematics, the teaching was utterly incompetent and horrible.)

About ME/CF (that I prefer to call M.E.: The "/CFS" is added to facilitate search machines) which is a disease I have since 1.1.1979:
1. Anthony Komaroff

Ten discoveries about the biology of CFS(pdf)

3. Hillary Johnson

The Why  (currently not available)

4. Consensus (many M.D.s) Canadian Consensus Government Report on ME (pdf - version 2003)
5. Consensus (many M.D.s) Canadian Consensus Government Report on ME (pdf - version 2011)
6. Eleanor Stein

Clinical Guidelines for Psychiatrists (pdf)

7. William Clifford The Ethics of Belief
8. Malcolm Hooper Magical Medicine (pdf)
Maarten Maartensz
Resources about ME/CFS
(more resources, by many)

       home - index - summaries - mail