*This post is based on a joint talk with Riccardo Guida given at IPhT Saclay on May 7th.*

Wolfram’s Mathematica has been the dominant computer algebra system for decades (at least in theoretical physics), and in an advertisement it even compared itself to Sauron’s One Ring.

Mathematica’s dominance however does not come from black magic, but rather from its quality and power compared to other available computer algebra systems. But dominant positions are often abused, and Wolfram’s commercial practices can verge on the abusive, though much less systematically than say Elsevier’s. In this blog post we will denounce the problems with Mathematica, and discuss four open source alternatives:

*,*

**SymPy***,*

**SageMath***, and*

**Maxima***. In the case of*

**FriCAS***, we will also provide a demonstration notebook.*

**SymPy**#### The trouble with Mathematica

#### Since a Mathematica license comes at zero marginal cost to Wolfram, pricing is determined by Wolfram’s commercial policy, and can

**vary a lot between customers**. Licenses are typically cheap for students; prices are higher for richer customers, and particularly high for non-academic institutions.

At IPhT Saclay, we have seen rather

**wild shifts in pricing**: we used to get 200 institute-wide licences for about 25.000 euros a year, we now get 10 licences for the same price. (Anyone at IPhT can use these licences, but we can run no more than 10 instances of Mathematica simultaneously.) Such shifts do not obey consistent rules, and depend a lot on the particular salesperson we are dealing with at a given time. We are sometimes offered bargains: for example, we recently bought cheap perpetual licenses for individual users on MacOS. Alas, in this case, the so-called perpetual licenses turned out to be unusable on the next version of MacOS – unless we paid 700 euros per license for an upgrade.

The main issue with Mathematica may however not be its price, but more generally its availability. If you write some Mathematica code now, there is

**no guarantee**that it can be run by your collaborators, the readers of your articles, or even by yourself in the future. (And the problem is compounded by the evolution of Mathematica, with one new major version every 2-3 years on average.) Your work is now subject to control by Wolfram: this is inconvenient and expensive nowadays, and could become disastrous if Wolfram got serious about milking the cow one day.

#### Advantages of open source software

#### In addition to solving the issues of cost and availability, open source software has a number of advantages:

- You can examine what the software does, and
**need not trust a black box**. - You can
**influence development**not only by reporting bugs, but also by writing code yourself, or giving money for adding a particular feature. **Collaborative coding**is easier with open source software, since people only need access to your code for being able to check, reproduce and improve it.

**meet the needs of most researchers**.

We will argue that open source competitors are good enough for allowing many researchers to do without Mathematica. The main remaining reasons that can prevent people from switching to open source are:

- if they need a particular advanced feature of Mathematica that is absent in the competitors,
- if they are captive of a large existing body of code and/or specialized Mathematica packages,
- if they belong to large collaborations, which would require a concerted switch.

#### Computer algebra systems at IPhT

#### We did a survey of computer algebra systems at IPhT, and got 42 answers (about half the researchers). The question was:

Which computer algebra system(s) did you use in the last 3 years?

Name | Open? | # Users |
---|---|---|

Mathematica | 35 | |

Maple | 7 | |

Matlab | 3 | |

/NumPy/SciPySymPy | ✔ | 10 |

SageMath | ✔ | 2 |

Maxima | ✔ | 4 |

FriCAS | ✔ | 1 |

Cadabra | ✔ | 1 |

As expected, Mathematica is more popular than all the alternatives combined. The nontrivial result is that most popular alternative is

*(together with other Python packages), which is used by nearly one quarter of respondents.*

**SymPy**#### Four open source computer algebra systems

We begin with a technical fact sheet:

SymPy | SageMath | Maxima | FriCAS | |
---|---|---|---|---|

Initial release | 2007 | 2005 | 1998 | 2007 |

Non-OS base | – | – | Macsyma 1982 | Axiom 1977 |

Contributors | 59 | 63 | 11 | 3 |

User Language | Python | Python-ish | Maxima | SPAD |

Interpreter | CPython, PyPy | CPython | Common Lisp | Common Lisp |

Expected speed | C/50 | C/50 to C | C/5 | C/5 |

Notebooks | Jupyter, TeXmacs | Jupyter, TeXmacs | wxMaxima, TeXmacs | TeXmacs |

The fine print:

- By contributors we mean how many people did more than 9 commits between 2018-03-15 and 2019-03-15. Obviously
and**SymPy**are much more actively developed than**SageMath**and**FriCAS**: this is particularly impressive in the case of**Maxima**, whose scope is narrower than**SymPy**’s. Both**SageMath**and**SymPy**regularly employ Google-funded interns.**SageMath** - Both
and**SymPy**are based on the Python programming language, a very widespread and easy language. Google can quickly find an answer to almost any plausible question about Python.**SageMath**has a dedicated language inspired by mathematics, and**FriCAS**’s language is not far from Mathematica’s.**Maxima** - The expected speed is compared to that of the
*C*programming language. Programs based on Python are slower, except when Python serves as an interface to code that actually runs in*C*. There is an ongoing effort to speed upand**SymPy**in this way.**SageMath**

*,*

**SymPy***,*

**SageMath***and*

**Maxima***are multi-platform, generalist computer algebra systems that have the expected basic features, including:*

**FriCAS**- limits,
- derivatives,
- Taylor series,
- basic integrals,
- linear algebra,
- special functions,
- polynomial equations,
- basic differential equations,
- replacements,
- arbitrary precision numerics.

: Generalized hypergeometrics, automatic generation and execution of code, rule-based integration tools (RUBI).**SymPy**: Manifolds, number theory, combinatorics.**SageMath**: Antiderivatives, noncommutative algebra, sparse polynomials.**FriCAS**

*is peculiar, as it includes the other open source systems, plus some modules of its own:*

**SageMath**This architecture has obvious advantages and disadvantages, in particular not all features of each included subsystem is available to users in a transparent way.=SageMathCore ⊕SageMath⊕SymPy⊕⋯⊕MaximaFriCAS

The best way to get an idea of the capabilities of a computer algebra system is a live demonstration. We have written a demonstration notebook for

*. It is publicly accessible in two versions: the .ipynb notebook itself, which can be run using Jupyter and*

**SymPy***, and the static .html output, which can be viewed in a browser. The end section of the notebook is a collection of useful weblinks on scientific Python.*

**SymPy**
But what's the point you want to tell. Shall we conclude wxMaxima is the best open source alternate for symbolic computations?

ReplyDeleteI used heavily wxMaxima, FriCAS and Mathematica.

Though Mathematica is powerful among all, price tag is the dragger. (Not missing Wolfram)

So I hope wxMaxima or FriCAS will be the choice.

Please comment your views.

Thank you for sharing your experience. The most suitable software for symbolic computations depends on the case: some users cannot escape Mathematica because they need specialized packages, others might be more or less sensitive to speed, etc. Personally I use SymPy but I also need SageMath for some specific calculations. Fortunately, SymPy and SageMath can cohabit in the same Jupyter notebook.

ReplyDelete