Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I hope this question is suitable for the site.

I recently had to work with Mathematica, and the experience was, to put it kindly, unpleasing. I do not have much experience with similar programs, but I remember not liking much Matlab or Maple either. The result is that I am a mathematician who likes programming, but I never managed to learn how to work with a computer algebra system.

Does there exist a CAS which can be programmed using a standard language? I guess the best thing would be just an enormous library of mathematical algorithms implemented for C or Python or whatever.

I know SAGE is based on Python, but as far as I understand (which is not much) it just collects preexisting open source software, so (I assume) one has to learn how to use a new tool for every different problem.

share|cite|improve this question
I believe in English it should be "displeasing." – Qiaochu Yuan Sep 3 '10 at 18:09
Your assumption (that one has to learn how to use a new tool for every different problem) is good but not entirely correct. AFAIK SAGE offers pretty uniform interface to all those tools it collects. :) – Pratik Deoghare Sep 4 '10 at 8:55
I think "unpleasant" would be more correct in this context. – Dennis Williamson Sep 4 '10 at 16:03
If Sage didn't collect preexisting open source software, it would suck. That is, any open source program that didn't collect all the others it could would suck unless it has been in existence for 10-20 years. And, I haven't had any problem working with Sage. I read a beginning book on Python and I use techniques from Python all the time. – Graphth Mar 14 '12 at 18:17
Matlab isn't a CAS anyway - it only has bindings to a CAS. Traditionally Matlab had Maple bindings for symbolic computations but Mathworks swallowed Mupad and sometimes bundles that with their Matlab version now. The main usage of Matlab is numerical computations and visualizations. In a nutshell numpy + matplotlib ~ matlab and sympy ~ CAS – Peter Sheldrick Oct 8 '12 at 16:04
up vote 4 down vote accepted

If you're a big fan of C numerous libraries exist for doing certain tasks. MPIR/GMP are two libraries for doing arbitrary precision arithmetic. On top of these you'll find more specialised libraries like MPC which adds support for the complex field.

Flint is a library that sits on top of MPIR, for example, providing an array of number theory functions. PARI/GP I believe provides a similar foundation but via the GMP library.

I'm sure if you googled "library for linear algebra" or "library for x" you would find it. However, a CAS unites all of this functionality.

Now we come to sage. From what I understand of the sage project, it is not so much a collection of open source libraries but an interface uniting them. For example, from the tutorial:

sage: a = 5   # a is an integer
sage: type(a)
<type 'sage.rings.integer.Integer'>
sage: a = 5/3  # now a is a rational number
sage: type(a)
<type 'sage.rings.rational.Rational'>
sage: a = 'hello'  # now a is a string
sage: type(a)
<type 'str'>

Is a sage session. As you're probably aware sage.rings.integer.Integer is not a built-in python type.

I would recommend giving sage a go. I think it is the closest thing out there to what you're after. I personally don't find Mathematica too bad.

share|cite|improve this answer

You should definitely use SymPy. It was invented in large part for this reason, because Ondřej Čertík didn't like how CAS systems like Mathematica invented their own language, which you had to learn if you wanted to write non-trivial stuff using the system.

SymPy is written entirely in pure Python, and the general execution of is in some kind of Python interpreter (for example, the isympy script is a convenience script that calls "from sympy import *" and defines some common variable names, and it also uses IPython if you have it installed).

Because of this, it's very easy to write scripts that work with SymPy, because they would just be Python scripts, where you import SymPy and work with it. But it's also easy to extend with your own functions. By subclassing SymPy objects and defining methods on them, you can make them work with built-in SymPy functions.

(full disclosure: I am the lead developer of SymPy)

share|cite|improve this answer

If you don't want to install all of Sage (which is quite big), you could perhaps try one of its components, SymPy, on its own to be begin with.

If you use C++ maybe GiNaC is useful (I haven't tried it).

share|cite|improve this answer

GiNaC and SymbolicC++ are C++ based CASs.

share|cite|improve this answer

Considering that Maxima is developed in Common Lisp and accepts CL sintax, maybe this system would suit your requirement.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.