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

How necessary it is for a person planning to do research in pure mathematics to learn programming as an undergrad?

And if it is, then which languages would you recommend to her or him? And why? I am currently a first year undergraduate, and here we have C in the first semester, and no other programming language in the whole course. Is it enough for me learn only this language or do I need to learn other languages too? If so, then which ones?

I apologize in advance if my question does not belong here and please shift it to wherever it does. Or if the similar question has already been asked.

Thanks in advance to all.

share|cite|improve this question
If you like logic, Common Lisp. Also – Asaf Karagila Dec 31 '13 at 14:47
@shrey : C is not that useful for pure math, when there are so many other languages that will do what you probably want to do so much more easily. It is possible for a pure research mathematician not to do any programming at all. However, if you are an undergraduate, you should consider learning some of the languages mentioned in the answers here so that you will be prepared to do research in an area of pure mathematics in which some programming or experimentation is useful. Someone mentioned Mathematica: you should also be aware of Maple. – Stefan Smith Dec 31 '13 at 16:20
I wouldn't get too caught up with the actual language actually. Learning to "think like a programmer" was my main takeaway when I took my first programming course. After that changing between different languages was just a matter of learning the different syntax and getting used to the quirks of each. – Kelvin Soh Dec 31 '13 at 17:38
i would like to ask you about what happened in you thoughts since these advices you'd received? – janmarqz Nov 5 '14 at 15:51
I ended up learning C as it was in my University syllabus, I wont still say that I know this fully well,but maybe pretty decent. And now I'm thinking of learning Python somewhere online. – shrey Nov 9 '14 at 10:59
up vote 9 down vote accepted

MATLAB, Mathematica, R, Haskell, Ruby, Python and others. There are mathematicians who use different languages. It depends on what you need done.

share|cite|improve this answer
@Amzoti Yes, sorry. Fixed it. – user117293 Dec 31 '13 at 14:58
Hey, Can you please tell me what I need to learn first at this stage (that is, after C )? I was thinking of python as I've heard that it is pretty easy for someone already knowas languages like C, C++. – shrey Dec 31 '13 at 14:59
@shrey Unfortunately, what you need to learn first/at all really does depend on what you want to do with it. If you're a first year undergraduate, you might not yet know what things in math you'd like to program (and I don't know which expensive things like Mathematica you have access to in school). – Mark S. Dec 31 '13 at 16:38

Definitely anything higher than C which is the language of system programming - which you ain't gonna do (and I may add, it only still exists for historical reasons). Also avoid C++ which frankly has become too complex and bloated even for the technicians (why not C++).

Forcing C even on computer undergrads was bad in 1989 (we started first semester by attempting to prove algorithms' correctness on paper à la Dijkstra; not sure whether that was a wholly successful approach but it made you think). Forcing C on math undergrads in 2013 is appalling beyond words.

Look at Scheme, Lisp or Clojure, take a look at Coq. Check out Prolog and its derivatives (currently I'm reading up on Flora 2). A Haskell is fine too. Avoid languages that need to be compiled and have no run-time interpreter loops for experimentation.

Somewhat related and because it brings back good memories: "A Parable" by Edsger W.Dijkstra, sometime in 1973

share|cite|improve this answer
I think you are being a little harsh although I get your point. Many times, a mathematician may not have a choice in what language (s)he is going to use because they will be working from established legacy code. I was a C programmer that went to work on software whose base code was created in 1963 in Fortran. Around that base the interface was constructed in C++, in which new algorithms were written as well. Whatever my preferences, I had to learn C++, which was a challenge but far from out of control. In fact, C++ evolved to the point where it was at least as fast as C in most computatio – Ron Gordon Dec 31 '13 at 15:58
C is a nice little language (since 1999; C89 or pre-standard C was decidedly less nice). I agree about avoiding C++ if possible, but I can't see what's so bad about teaching C. It's not the best choice for teaching to math undergrads, since higher-level languages offer more convenient APIs, but it ain't so bad. – Daniel Fischer Dec 31 '13 at 16:55
Python isn't a bad choice neither, if you want to be able to solve simple general-purpose programming tasks. And it has SciPy and Matplotlib libraries (basically the same functionality as Matlab). – maxy Dec 31 '13 at 19:58

To develop the algorithmic instincts you want, you ought to learn a lot of abstract algebra, including subjects such as Cauchy's and Sylow's theorems on finite groups as well Schreier's and Kurosh's theorems on discrete infinite groups.. Plenty of evidence of this trend you can easily get by a simple look of some CAS like GAP or others.

share|cite|improve this answer
I'd like to see some of your thoughts about this. How do Sylow's theorems develop one's algorithmic instincts? – Ryan Reich Dec 31 '13 at 17:13
For example, you can use an inductive method prove the existence of Sylow's subgroups.. Here my clumsy attempt:… – janmarqz Dec 31 '13 at 17:29
Induction is not programming, though programming certainly uses it a lot. But none of the concerns specific to programming, or the benefits of taking an essentially algorithmic approach to one's work, are evident in inductive proofs a priori. – Ryan Reich Dec 31 '13 at 20:12
I suppose that helps a bit to an undergrad, then – janmarqz Dec 31 '13 at 20:45

I am a PhD student in pure mathematics, doing research in symplectic geometry/representation theory, and I consider programming to be one of the most valuable skills I have. Part of the problem to starting math research is that you have no clue what problem to solve. I find it impossible to just sit at your desk and wonder, "What theorem should I prove today?" In order to gain a sense for what theorems I want to prove, I always investigate problems on the computer in whatever way I can.

I used to program in MATLAB, but have been recently converted to SAGE ( I cannot recommend SAGE highly enough. SAGE is an object oriented scripting language based on Python. It is high level and easy to quickly write code that works. It has built in packages that allow you to define modules, rings, groups, graphs, solve ODEs, integrate stuff - I could go on forever here. If you can think of a mathematical object, someone has probably already written a package in SAGE to handle it. There is also an excellent community over at where you can ask questions.

Oh, and everything is free and open source.

share|cite|improve this answer
give me please your comments on GAP and on doing combinatorial group th. – janmarqz Jan 3 '14 at 16:32
@janmarqz I have never used GAP to do any combinatorial group theory, so I don't think my opinion on the subject is of any value. – jmracek Jan 7 '14 at 21:28

Esoteric Programming Language should be suitable for mathematicians who love problem solving.

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.