logo back up home forward   further reading more topics »

Computer Algebra Programs

In order to work with the mathematics on this site it is useful to have a computer algebra program. It is possible to do numeric arithmetic, involving integers, floating point, complex numbers, vectors, quaternions, matrix and so on, in most programming languages. Most languages have mathematical libraries that that help with these sort of numeric calculations.

However, when we want to do more general computer algebra, involving symbolic values and more abstract algebra concepts, then things get a bit more complicated. We could either try to code these things using a mainstream computer language or use a CAS (Computer Algebra System) that is a language or program specifically designed for computer algebra. There does not seem to be an ideal solution here, each approach has disadvantages as well as advantages.

There are some specific requirements for a language to support a CAS. If we were to start to write some code to support some given algebra (say - vectors) then we soon find we need to use dependant types (or at least some weaker form of dependant types), we then need to make some tradeoffs between this requirement and type safety and things get messy. As far as I know, no mainstream, statically typed languages support dependant types, perhaps some variants of ML?

Therefore we need to investigate CAS programs that are designed specifically to support user defined algebras.

For a wider discussion of computer projects for mathematics see this page.

Axiom

Axiom uses a language called 'SPAD' (a shortened form of the word 'Scratchpad') to allow users to define algebras. It comes with a big library of algebras which interwork with each other, users can add their own algebras to interwork with these. I have described SPAD on this page, axiom comes with both an SPAD compiler and an interpreter.

SPAD is built on top of the language 'Lisp'. The development environment for SPAD is minimal, programs are edited using any text editor and run form the command line. The error messages are often very unhelpful and frequently refer to the underlying Lisp code.

The learning curve for SPAD is very steep, many feature of the language such as the pattern matching used to dispatch functions can be difficult to understand and try to work out what function will be called. A mathematics program really needs to be more predictable than this. The type system does have its limitations, its not possible to represent category theory concepts such as monads in the way that languages like Haskell or Scala can.

Having said all this, SPADs tradeoff between dependant types and type safety is very powerful, I think the language deserves to be much more widely used if only some of these issues could be tackled.

Axiom is a free (open source) general purpose computer algebra system. It has been in development since 1971 originally as Scratchpad by researchers at IBM under the direction of Richard Dimick Jenks. In the 1990s it was sold to NAG and given its current name. In 2001 it was withdrawn from the market and released to Tim Daly, the project lead developer, under the Modified BSD License. In 2007, Axiom was forked into two different open source projects: OpenAxiom, and FriCAS. The amount of developer activity seems very low at the moment and it is a pity that the developer effort and user resources are fragmented in this way.

Just to explain the issues involved I will go through some of my experiences in using these programs with the openSUSE operating system, you may have different expeiences so I'm not suggesting you make the same choices as me, if you have any problems both forks have email groups.

My Expieriences using openSUSE 11.1

start axiom

Just by chance I first tried Axiom (see this page for details). At first this went very well except that anything involving the draw function failed with:

>> System error:
Unknown bfd format

This was a bit annoying, but since I did not need to use the draw function it did not hold be back, however when I first compiled an SPAD program and tried to use it I got the exact same error:

>> System error:
Unknown bfd format

This was a big problem so I asked on the email group and altough they are helpful and friendly there were no answers to this particular problem.

So at this stage I thought I would try another fork: FriCAS (see this page for details). At first this was worse, I could not even get the program to start, every time I ran the script to run FriCAS, the cursor steped down about 3 lines and then, after a short delay, returned to the command line prompt without any error messages on the system at all.

So I asked about this on the FriCAS email group and they also are are helpful and friendly there, in the end Bill Page found the answer, it seems that on SuSE the virtual memory limit is set rather low by default. The command:

ulimit -v unlimited

added to the startup script removed this limit and now the FriCAS program works perfectly, including draw function and user compiled programs.

 


metadata block
see also:
  • For a wider discussion of computer projects for mathematics see this page.
Correspondence about this page

Book Shop - Further reading.

Where I can, I have put links to Amazon for books that are relevant to the subject, click on the appropriate country flag to get more details of the book or to buy it from them.

flag flag flag flag flag flag Axiom Volume 1: Tutorial. Documentation is freely availible from: http://www.axiom-developer.org/axiom-website/documentation.html

 

Commercial Software Shop

Where I can, I have put links to Amazon for commercial software, not directly related to the software project, but related to the subject being discussed, click on the appropriate country flag to get more details of the software or to buy it from them.

 

This site may have errors. Don't use for critical systems.

Copyright (c) 1998-2013 Martin John Baker - All rights reserved - privacy policy.