MathOverflow is a question and answer site for professional mathematicians. It's 100% free, no registration required.

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

For background: I'm working on a book to help mathematicians learn how to program. However, I need to see some examples from people in the field that have done different kinds of things than I have.

Where have you used programming in your career as a mathematician? (If you haven't feel free to say so, though it isn't very helpful)

I've currently used programming in several math-y settings. Computational Biology, Image Processing (Fourier Transforms and other things like that), writing scripts that comply to a certain data restriction or to a library. I've looked at some computational algebraic geometry, but not much as of yet, and I'd use SAGE or sympy if I needed that.

share|cite|improve this question
You may also want to look at the recent question on experimental mathematics. Some answers there may apply: – Willie Wong May 9 '10 at 11:01
See also this thread on cstheory:… – Suresh Venkat Aug 27 '10 at 22:15
This discussion on computer experimentation may interest you as well: – Adeel Khan Sep 6 '10 at 3:23
Depends whether writing TeX is considered computer programming. – Gerald Edgar Aug 31 '15 at 15:19

14 Answers 14

Look at any of my published papers! :-)


  1. Solved huge systems of quadratics in order to construct exotic subfactors.
  2. Calculated R-matrices for representations of various quantum groups, in order to systematically identify coincidences amongst small modular tensor categories.
  3. Implemented a parallelisable, caching algorithm for computing Khovanov homology, in an attempt to disprove the smooth 4-d Poincare conjecture.
  4. Enumerated bipartite graphs satisfying certain combinatorial conditions, filtered by largest eigenvalue, in order to classify subfactors up to index 5 (slides).
  5. Looked for small real cyclotomic integers which are larger than all their conjugates, in order to verify the many cases of a theorem identifying those smaller than 76/33.
  6. Proved identities involving q-binomial coefficients using the methods of A=B.

and then a whole lot of stuff that hasn't yet, or won't ever, make it into print.

share|cite|improve this answer
Thanks Scott, I really appreciate it! I'll read them ASAP – Michael Hoffman May 9 '10 at 8:05
Well, sometimes the computer code is slightly below the surface. But feel free to ask if you want more details. – Scott Morrison May 9 '10 at 16:43

I've used computers to do some group theory calculations. I was too lazy to figure out how to do them in GAP, so I wrote the programs I needed in C++. One particular paper that I used them in is my paper "The Picard Group of the Moduli Space of Curves with Level Structures". The paper and code are available on my webpage here.

In that paper, I needed to know some twisted group cohomology groups. The groups depended on a parameter $g$, but I could prove that they were independent of the parameter once $g$ was large, so I was able to reduce myself to computing a finite number of cases on a computer.

share|cite|improve this answer

I am a pure mathematician interested in representation theory.

I computed $q$-characters of $\ell$-fundamental representations for the quantum affine $E_8$ by a SUPERCOMPUTER. See

There is more famous project on $E_8$:

I believe there are lots of other computation in the representation theory of exceptional groups, which require lots of memory.

They are usually based on recursive algorithms, and one cannot use the parallel computing.

When I computed $q$-characters, I could not find any guides explaining how to code a program for such a problem. I appreciate very much if an expert could give me any references.

share|cite|improve this answer

I've used programming in MATLAB for countless things. Some highlights:

  • bioinformatics: besides testing published algorithms, I also developed algorithms for producing surrogate *NAs with completely specified short-range subsequences and biologically plausible codon structure, for molecular phylogeny, and a toy model of *NAs with specified nearest-neighbor thermodynamical properties. In related work I used a numerical calculation to rule out a class of hypotheses about the binding kinetics of oligomers;
  • networks: modeling queueing networks and prototyping network monitoring data structures, visualizations and algorithms involving generalized statistical physics and continuous-time martingales and change detection techniques, as well as post-processing outputs from multiple prototype network monitoring systems. Besides prototyping, I've also used MATLAB for QA purposes in my company;
  • I outlined some combinatorial calculations about necklaces in MATLAB and C for porting to a reconfigurable computer;
  • I elucidated the structure of the Lie algebra of the stochastic group, particularly completely explicit Levi decompositions (this is no trivial feat in a numerical language)--someday I'll clean this up and put it on the arXiv;
  • I produced periodic lattices with permutohedral boundary conditions (used so far to validate a 2D lattice Boltzmann model by approximating the initial decay of a Taylor-Green vortex);
  • I enumerated the minimal periodic colorings of the root lattice $A_N$ for $N$ small by means of permutation matrices;
  • I've analyzed detailed behavior of Anosov systems (e.g., the cat map and a map topologically conjugate to the cross section of the geodesic flow on a surface of negative curvature).

I'm sure I could think of other stuff that has been especially useful to my work. I use MATLAB more days than not.

share|cite|improve this answer
Hoping you'll get those Levi decompositions on arxiv someday, I'm looking at nonnumerical computations in particular. – Michael Hoffman May 17 '10 at 3:38
If you want I can send you a rough draft. My email is sh [at my domain name]. – Steve Huntsman May 17 '10 at 3:42

My PhD supervisor and I discovered a new near octagon, related to the finite simple group $G_2(4)$, using a computer. From this we were able to give a construction of the full Suzuki tower, which was initially verified with the help of a computer. See this, or the published version.

This also gave us several other well known strongly regular graphs (see the Remark in Section 5) which were all checked to be strongly regular using SAGE. In fact, I used GAP and SAGE extensively to find several results for which we later found computer-free proofs.

The fact that the automorphism group of this near octagon, which is the same as the automorphism group of its point graph, is isomorphic to $G_2(4):2$ was first checked using SAGE which probably uses the nauty package by Brendan Mckay. And all the group theory stuff in Section 3 of that paper was done using GAP.

share|cite|improve this answer

I often write small programs in various languages (Perl, C, Maple, HP 50G) to generate complicated pictures, perform tedious algebraic computations to test conjectures, or simulate random processes.

share|cite|improve this answer

I wrote a series of algorithms to find bounds on the homology of finitely-presented groups and implemented them in GAP in Graham Ellis has written the GAP package HAP,, which does some group (co)homology calculations.

share|cite|improve this answer

I've used computers in a variety of ways, some fairly simple and some more complex. I'll restrict myself to usages that resulted in publishable work.

  • As a grad student, Dev Sinha inspired me to come up with a formula for the type-2 invariant of knots, as a signed count of quadrisecants (lines that intersect the knot in precisely four places). Technically the count only worked for "long knots". I implemented the count and generated animations which included the quadrisecants. After seeing the quadrisecants created and destroyed in enough situations I came up with a formula for closed knots. Eventually, this led to Garret Flower's Thesis, where the formula is a count of the family of round circles that intersect the knot in a pentagram. The code was written in C++ to find the quadrisecants / circular pentagrams. That data was fed to PoVRay to generate the images.

  • Recently I've been developing Regina, which is a package for studying triangulations of low-dimensional manifolds. I have a few objectives with this project: studying the 3-manifolds that embed smoothly in $S^4$, studying the "small" triangulable 4-manifolds, and such. This is a rather big project, and Regina is quite a bit bigger than my contributions to it. It's written in C++ and Python. Recently I've come across some new knot exteriors in homotopy $4$-spheres. I'm in the process of building a table of small knot exteriors in homotopy $4$-spheres, as well as attempting to prove all `small' homotopy $4$-spheres are PL-equivalent to $S^4$, etc.

share|cite|improve this answer

Possibly the most common thing I use a computer for is the Todd-Coxeter algorithm, which enumerating finite index subgroups of a finitely presented group. I can't count how many times I have used it. It comes standard with the computer package gap (or MAGMA which has similar functionality, and is freely available at North American Universities).

I think this algorithm might be worth a mention in your book, because it's cool, but rarely something you would ever want to do by hand. For me, this is often what I want a computer to do, quickly compute some examples, so I can tell how half-baked an idea of mine might be.

Also, both gap and magma give you the option to generate either the complete list of subgroups at a given index or iterate through the list of subgroups if you just are looking for an example with a given property. So it would could serve as a useful way to introduce iterators.

share|cite|improve this answer

I've used computers to prove a theorem about a complex dynamical system. See So have others. See Proving Conjectures by Use of Interval Arithmetic.

share|cite|improve this answer

I've worked (and still continue to work) on K-nearest-neighbor analysis for image segmentation and multispectral and hyperspectral data classification, and worked on trying to improve the algorithms for speed and to require less interaction. I've also worked on writing C programs, which work much faster than interpreted Octave or Matlab code, for image analysis and texture analysis, and for image segmentation based on local feature analysis. This is all very different from the types of mathematics I used and learned in academia.

I've also run simulations of some games I've played recreationally to answer some simple questions using backtracking algorithms, for example, a card game akin to playing tic-tac-toe on a 4-dimensional lattice which I used as an answer to Favorite mathematical puzzles and toys.

share|cite|improve this answer

A simple but important answer (in my opinion) is to understand the behavior of some random process.

For instance, imagine that you are drawing balls of different colors out of an urn and replacing them according to some rule. What do you expect to happen? If you are not sure how to start on this problem analytically, you can just simulate it a million times and visualize the results.

share|cite|improve this answer

I do not usually use much computers for doing maths, but I had quite a need for them recently. It was a Riemannian geometry question (isoperimetric inequalities) we worked on with Greg Kuperberg, and at some point we needed to check that a certain very explicit function on 3 variables was nonnegative. We did not find a simple way to study this elementary function by hand, and the best we could do was to use differential calculus to reduce our problem to proving that a certain system of polynomial equations had no other real solutions than the one we knew. We checked that using SAGE.

See Lemmas 7.1 and 7.4 in the [paper]( for details.

share|cite|improve this answer

All the answers in question are about use of programming in research, while the question is about your career. Like many others, I am a pure mathematician, but have made good use of programming skills in some of my papers, however I've also made use of programming in teaching and a little miscellany. Here are some examples:

  • In a cryptography course, I had an associated computer lab where I taught some basic programming in Python and we used these to write code for implementing and breaking various ciphers.

  • In a graph theory/social networks course, I also had an associated computer lab where I taught some basic programming in Python and use of Sage, and we did things like implement Google Pagerank to rank sports teams.

  • I've written code to format data to use in R for a statistics class.

  • You know how it is painful to reformat tables of data in LaTeX (e.g., change the number of columns)? I wrote code to do it for me.

In general, I think teaching our students to be able to program and work with data on the computer is important for their professional preparation. Several students have told me after graduating that what they learned was quite helpful for them (even though some of them really did not enjoy it at the time).

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.