This question has its origins in this entertaining discussion on MO.

There are many programs (CAS) and libraries that are able to handle algebraic expressions. These are both a verification tool for (sometimes nightmarish) computations and a way to explore objects for which a good intuition is not available.

Among them, I have in mind Mathematica, Maple, Magma, and also the Python-interface Sage (including lots of packages like NumPy, SciPy, Maxima, GAP, etc.). Sage has the appeal to be free and open source, however I wonder if it is at the same level of the others.

To narrow the question to a more specific field, for every language has its advantages somewhere, I am interested in automorphic forms and number theory. Thus the basic uses will be to manipulate automorphic forms for different groups and congruence subgroups, to locate zeros of the associated $L$-functions, compute Fourier coefficients, etc.

What are the pros and cons of these programs to work with automorphic forms?

Every direction of answer is welcome, in particular taking into account

  • ease of use
  • available literature (not on the program itself, but related to automorphic forms)
  • regular updating of packages and functions
  • community size for support and discussion

1 Answer 1


The only CAS's that have built-in support for modular and automorphic forms, as far as I know, are Sage and Magma. [Edit: I had forgotten Pari/GP, which will introduce substantial modular forms functionality as of version 2.10 which is currently in alpha testing; see Aurel's comment below]. Both Sage and Magma offer roughly comparable functionality. In Sage you can do something like this:

│ SageMath version 8.1, Release Date: 2017-12-07                     │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
sage: S = Newforms(Gamma1(7), 4, names='a'); S
[q - q^2 - 2*q^3 - 7*q^4 + 16*q^5 + O(q^6),
 q + a1*q^2 + (-7/2*a1 - 7)*q^3 + (2*a1 + 4)*q^4 + 7/2*a1*q^5 + O(q^6)]
sage: f = S[0]
sage: f[next_prime(1000)]
sage: L = S[0].lseries()
sage: L(0.5 + 4.0*I)
6.68198475901674 + 1.21937727142056*I

William Stein (original author of most of this code) has written a wonderful book "Modular Forms -- A Computational Approach", which describes all the theory and algorithms, with copious Sage code examples.

You ask:

"Among them, I have in mind Mathematica, Maple, Magma, and also the Python-interface Sage. [...] Sage has the appeal to be free and open source, however I wonder if it is at the same level of the others."

Where modular forms are concerned, it's certainly not the case that Magma has a clear lead over Sage -- some functionality is better implemented in one or the other, but there's not an obvious winner overall. Both have flourishing user communities, regular updates, etc.

On the other hand, Mathematica and Maple are both completely useless as tools for number theory; they're great at symbolic manipulation of algebraic expressions, but that's more or less all they do. (I work on modular forms, and I can count on my fingers the number of times I've found Maple or Mathematica useful, whereas I use Sage and/or Magma every couple of weeks at least.)

  • 4
    $\begingroup$ pari/gp also has classical modular forms : pari.math.u-bordeaux.fr/dochtml/html $\endgroup$
    – Aurel
    Apr 27, 2018 at 15:18
  • 1
    $\begingroup$ It includes weight 1 and half-integral, expansion at all cusps, petersson product etc. which I am not sure that magma or sage have. One should also note that magma has Hilbert modular forms. $\endgroup$
    – Aurel
    Apr 27, 2018 at 15:24
  • 1
    $\begingroup$ Sage does, in fact, have weight 1 forms, and Petersson products of level 1 forms (both implemented by me, as it happens). But Pari/GP's implementation seems to be rather more general; I've edited my answer to include this. You are also quite correct that Hilbert mod forms are one important thing that Magma does have which neither of its competitors offer at present. $\endgroup$ Apr 27, 2018 at 19:38
  • $\begingroup$ I am theoretical physicist and as such use Mathematica a lot. But when I have to use modular/automorphic forms, I immediately switch to Sage. $\endgroup$
    – Antoine
    May 2, 2018 at 16:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .