More and more I am becoming convinced that one should know at least one programming language very well as a mathematician of this century. Is my conviction justified, or not applicable?

If I am right, then please what languages should someone aspiring to be a mathematician learn? The number out there is so bewildering for a complete novice to judge, and no one else can judge suitable ones than a body of working mathematicians, hence my posting this question here specifically.

In particular, this language should be very useful for mathematics applications, should be close in syntax and structure to mathematics, and be mathematically related in other relevant ways. Indeed you may suggest a language that you have found useful/important in other ways not mentioned, but please explain why you make these suggestions clearly.

Thank you.

PS. I couldn't find sufficiently relevant tags. Please improve as appropriate.

closed as primarily opinion-based by Gerald Edgar, Jan-Christoph Schlage-Puchta, Mark Sapir, Ben Linowitz, arsmath Aug 26 at 7:15

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 11
  • 14
    Is the mathematics in question e.g. PDE or category theory? The answers might be different. – Tommi Brander Aug 21 at 8:20
  • 6
    Depends on your intended use. I recommend my students not familiar with programming to start with Python which has many useful math packages. A more specialized program I recommend is R. It is extremely versatile in probabilistic and statistical applications. Myself I use MAPLE for many of my rather limited needs. – Liviu Nicolaescu Aug 21 at 9:01
  • 24
    Academic mathematicians should know a student who can do their programming for them. – Gerry Myerson Aug 21 at 12:39
  • 12
    This is sort of like saying, "More and more I am becoming convinced that one should know at least one notation for differential geometry very well as a mathematician of this century." You may or may not need to know differential geometry for your work in your field, and if you do need to know it, the main thing is to understand it, not what notation you will use. If you know one programming language, learning another is just a minor chore, like learning a new notation. But the ideas of computer science and programming (which are two different things) are nontrivial. – Ben Crowell Aug 21 at 16:54

18 Answers 18

Python, so they can use Sage. From their website:

SageMath is a free open-source mathematics software system licensed under the GPL. It builds on top of many existing open-source packages: NumPy, SciPy, matplotlib, Sympy, Maxima, GAP, FLINT, R and many more. Access their combined power through a common, Python-based language or directly via interfaces or wrappers. Mission: Creating a viable free open source alternative to Magma, Maple, Mathematica and Matlab.

  • 6
    @ManuelBärenz for a start you can do homology calculation and some things on manifolds: But I guess it depends very much on the problems you are looking at. – Moritz Firsching Aug 21 at 9:46
  • 8
    Sage is good for discrete mathematics. It has lots of symmetric functions, graphs, posets, permutations, etc. Everyone I know that works in algebraic combinatorics use Sage (well, that or Maple or Mathematica). – Per Alexandersson Aug 21 at 10:32
  • 10
    @ManuelBärenz Sage has been very useful to me for number theory, algebra, and algebraic geometry too. But it does more than that even. – PrimeRibeyeDeal Aug 21 at 12:52
  • 4
    You cannot go wrong with python. As a bonus, you can now create small games easily to showcase your work to laymen, you can parse information from websites, you can communicate with sensors, you can create nice 3D online diagrams, you can display results on a map, you can build a complete website,.... You don't have to but it's nice to have the possibility. All with the same language, just with different APIs. – Eric Duminil Aug 22 at 6:33
  • 1
    This link might be useful: – Ennar Aug 25 at 1:21

Depends on their specific field.

  • In numerical mathematics, Matlab is the de-facto standard (unless you need high performance computing, but then you start to become more a computer scientist than a mathematician), and Julia is the promising one that could take over it in the future.
  • In applied probability / statistics, R is the de-facto standard.
  • In algebra and number theory, there are a few specialized languages such as Pari/GP and GAP.
  • In combinatorics or analysis, you probably need none of these ones, but it will be useful to know Mathematica for the occasional complicated symbolic calculation or integral.
  • If you have to choose only one, Python (for Sage) is a good generalist choice. Does a bit of everything, but worse than a specialized language.
  • 7
    Sage includes a copy of, for example GAP, so in principle it can do everything GAP can, which makes me wonder in what sense Sage can be deemed worse? – Gordon Royle Aug 21 at 11:25
  • 27
    If you can get away with not using Matlab, do. Matlab is prohibitively expensive and makes it hard for others to review your code, unless they also have painfully expensive licences. More: – yochannah Aug 21 at 12:18
  • 6
    @GordonRoyle But to use 'Gap inside Sage' you have to learn the Gap syntax. At that point, you effectively know two languages, not one. Also, if you wish to allow that reasoning, Gap can also do everything that Sage does because you can install a copy of Sage on the side and call it using Exec... – Federico Poloni Aug 21 at 12:44
  • 3
    While I agree with this sentiment, I wouldn't call any of these except Python a programming language. – Kimball Aug 21 at 14:36
  • 5
    @yochannah If you want to avoid Matlab but still learn Matlab syntax, you can use octave which is free and has the same syntax but not nearly as many libraries. But for the stuff I used to use Matlab/octave for, I'd use Python (mostly numpy) today. – Sumyrda Aug 21 at 18:24


This is perhaps not the answer you are looking for, but it is indeed a programming language (it is Turing complete), and it is also a language that every professional mathematician needs to learn. One can make quite nice graphics with for loops and the similarities with more 'traditional' programming languages are there under the hood.

One can also use AutoHotKey to automate TeX commands. For example, typing math symbols in Unicode character is quite handy. Windows only.

  • 2
    I would say plain or AmS-TeX rather than LaTeX. The latter (for me) is like a straitjacket. On the other hand, the other two are much more flexible and encourage actually thinking about how to do things. – David Handelman Aug 21 at 13:51
  • 8
    @DavidHandelman, I think any experience looking at TeX in the wild shows that mathematicians, like any other people, when given the freedom not to think about how to do things, usually don't. Plain and AMSTeX both offer freedoms that LaTeX doesn't (and probably conversely), and can be used to do great things; but I think that in many ways it is easier to go non-obviously wrong with plain and AMSTeX than with LaTeX. (Also, in my limited exposure to people who write them, they seem to encourage presentational, rather than semantic, markup.) – LSpice Aug 21 at 13:54
  • 15
    While it is a programming language, and it is something a mathematician should learn, these statements are completely unrelated. – Christopher Aug 21 at 15:39
  • 2
    Programming in LaTeX3 is far easier than either Plain TeX or LaTeX. There are lots of examples of proper programming over on Of particular note, I would point to – Loop Space Aug 21 at 16:19
  • 2
    +1: Potentially not what they were looking for but SUPER useful! – Theodore Weld Aug 22 at 5:03

One should probably also mention functional programming languages based on some form of typed lambda calculus such as Haskell. There is quite a bit of category theory going on in the type systems of these languages which can be familiar ground and an exciting application of their mathematical knowledge for a lot of mathematicians.

Moreover, Curry–Howard correspondence says that "types are propositions" and "terms are proofs", so one could argue that programming in such languages is the same as proving theorems. This approach is especially prevalent in dependently typed languages such as Coq.

But perhaps you're not a category-theorist or logician (or at least don't think of yourself that way). That's okay - languages like Haskell are still a great way to set up mathematical computations. This is because in Haskell, describing to the computer how to do computations is generally very similar to describing to other mathematicians how to do the same computations!

As an example in low-dimensional topology, consider the following code fragment from, which computes the Kauffman bracket of a knot diagram specified using PD notation

kauffman :: PD -> R
kauffman [] = one
kauffman (Join a b:pd) | a == b    = (-av*av-ai*ai) * kauffman pd
kauffman (Join a b:pd) | otherwise =
   kauffman (map (fmap (\c -> if (c == a) then b else c)) pd)
kauffman (Cross a b c d:pd) =
  ai * kauffman (Join a b:Join c d:pd)
    + av * kauffman (Join a d:Join b c:pd)

The last four left-aligned lines give four definitions of the kauffman function.

The first line, kaufmann [] = one is a base case specifying the Kauffman bracket of the empty diagram. The second line is the rule for eliminating disjoint circles, and the fourth line is the crossing axiom. (The third line handles some technicalities in PD notation.)

If you've ever seen a talk on the Kauffman bracket (or the Jones polynomial) you've seen these three axioms, and they're just about all we need to tell Haskell to get it to compute Kauffman brackets! So there's obviously something very appealing to mathematicians going on here.

For the curious, some specific features of Haskell (which are common among statically-typed functional languages) that enable this programming style are:

  • lazy evaluation;
  • type polymorphism;
  • treating functions as first-class values; and
  • a good algebraic data type system.
  • 7
    I think this is not a helpful answer for motivating why a non-category-theorist/logician should learn Haskell. The advantage of statically-typed functional* languages like Haskell for any mathematical computation is that one can describe to the computer how to do computations in a way that is very similar to how mathematicians describe to one another how to do computations. *(There are a few more features that really make this straightforward but are a bit too technical to enumerate here.) – dvitek Aug 21 at 12:17
  • 7
    As an example of what I'm talking about, see, specifically the last 8 lines (where four cases of the "kauffman" function) are defined. This is exactly how the Kauffman bracket is defined in talks - just do a recursive computation. Pretty much everything else is syntactic sugar. One nice thing about languages like Haskell is that we don't have to set up a syntax for "iterate over all vertices" or anything like that - we can just say "here's what I want, here's how you do the expansion, here are the base cases, now tell me the answer". – dvitek Aug 21 at 12:19
  • 1
    I agree that that's an important point that is missing in my original answer. I'd like to encourage you to extend the answer with it as you seem to know some nice examples of Haskell code resembling mathematical notation. – Aras Ergus Aug 21 at 13:11
  • 5
    Hi @ArasErgus, I've done so. I also apologize for the "not a helpful answer..." language - it sounds harsher than what I intended, which was more "you're not giving Haskell the credit it deserves for being a good general-purpose mathematical programming language." – dvitek Aug 21 at 21:45
  • 1
    Another reason to learn Haskell: the diagrams EDSL, a good alternative to TikZ. – Elliot Gorokhovsky Aug 22 at 18:03

My answer is: TikZ

This is a programming language, often used in combination with LaTeX, for producing high-quality graphics.

I view this language as important for mathematicians, not because mathematicians will use it to solve their mathematical problems, but rather, because mathematicians will use it to communicate their mathematical ideas to others. I believe that almost every mathematics paper would benefit from having more and better graphical illustrations, and TikZ output is often superb for this.

Here are some sample figures that I programmed in TikZ for some of my recent work, including research papers and expository work. I am just a beginner, and I am sure that there are other users on MathOverflow who are truly expert. For example, Joseph O'Rourke is a master of graphical presentation, and my impression is that many of his figures might have been created with TikZ. I would expect that he can provide some inspirational examples.

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

  • 1
    You can see more examples in my Twitter media feed at – Joel David Hamkins Aug 22 at 0:15
  • 1
    And ridiculously more over on – Loop Space Aug 22 at 7:08
  • 1
    Is there some good introduction to TikZ, apart from the reference manual? – darij grinberg Aug 22 at 10:21
  • 2
    Very impressive graphics! And thanks for the shout-out. Actually, I often use Mathematica for calculations and numerically accurate geometry, and Adobe Illustrator to supplement the Mathematica or for free-hand drawings. – Joseph O'Rourke Aug 22 at 10:54
  • 1
    @JosephO'Rourke Thanks for the kind remark, which means a lot, coming from you. You seem routinely to produce graphics of extremely high quality. – Joel David Hamkins Aug 22 at 11:39

this language should be very useful for mathematics applications

As already said, this is a bit vague – maths applications are extremely different across fields, and most fields have their specialist language. (See below for a brief and incomplete survey.)

My opinion is however that a good programming language's hallmark is that it can abstract over many different topics, and allow you to just write domain-specific libraries for the different applications. Indeed quite a lot of people from different areas have moved to Python in the last years. They just use different libraries: NumPy/SciPy/MatPlotLib is pretty much a drop-in replacement for Matlab or R; Sage or SymPy can replace much of Mathematica; etc..

I don't think there's a deep reason why only Python has succeeded in unifying so many maths people. It does have a nice, concise-yet-clear syntax, but many general-purpose programming languages would be able to do the job just as well given the effort in library development. Java, C++, Common Lisp, Haskell, JavaScript and Ruby are all well-equipped for using libraries to handle many different applications. Java and C++ are verbose though, Lisp and Haskell have unusual syntax, dynamical languages (but that includes Python too!) are slow.

should be close in syntax and structure to mathematics

Although already Fortran attempted to be closer to maths in syntax (the very name means formula translation), in fact most programming languages – even the specialist ones I listed above! – differ in a very fundamental way from how maths is formulated: they are imperative at least at the core. Meaning, programs have a time sequence built in: do this, then do that... but maths doesn't work this way: there is no time in maths, you make definitions “for eternity”. This corresponds to declarative programming, which includes Functional languages and Logic languages. A lot of languages have taken influences from functional programming, but even those that call themselves functional languages are usually imperative in some way. Pure functional languages include Haskell, Agda and Idris. Agda is mostly used as a proof assistant like Coq.

and be mathematically related in other relevant ways

Haskell uses quite a lot of category theory. Other programmers sometimes denounce this as crazy abstract nonsense, but it opens up new ways of thinking about the very nature of computation. In particular, because category theory is so abstract and general, it allows you to not only use the language for very different applications, it also allows you to write polymorphic functions that will work for completely different applications and do in each instance the right thing for the use case.

It may have become obvious at this point that I'm a Haskell fan, so let me just list a few more points in its favour:

  • It is well-suited both for small, one-off scripts and for big programs that have many modules and use powerful libraries.
  • It is free, and has a reasonably big ecosystem of open-source libraries. (And package managers that make it easy to use them without fiddly manual installations.)
  • It is fast. Although the language emphasizes mostly safe high-level programming, it has an optimising compiler that can take it up with the industry-standard Java and with some care even with C. And because of its purely functional nature, it is particularly well-suited for parallelization.

My recommendation: learn Python and Haskell.

Here an overview of specialist languages that are good to know if you're eyeing a particular field of mathematics:

  • Many (most?) numerical PDE solvers are even today still written in Fortran, although the language is grossly outdated in many ways. (“It's the fastest” is the typically quoted reason, though actual benchmarks show that C, C++ and Rust are not slower and many other compiled languages aren't far behind either.)
  • The field of signal processing, and generally more lightweight numerics stuff was at least until a couple of years ago dominated by Matlab. Matlab has a very domain-focused syntax that assumes you want to describe everything as a vector/matrix/tensor, i.e. a multidimensional array of numbers. It is slow but has optimised built-ins (written in C) that make many common task fast in practice.
  • Statistics people use R. I don't know much about that, but it seems they use it very similar to Matlab.
  • If you mostly want some assistance with “old school pen and paper algebra”, then a CAS is the standard choice. Mathematica is the biggest.
  • Whereas all of the above basically just use computers in the sense of “calculate some result” (requiring that you actually set the calculation up in the way that the result says what you think it does), there is also the computer-assisted proof. Languages like Coq are intended to be used for fully describing the problem and solution, and only even accept programs (i.e. proofs) that are logically correct. They seem to be used mostly in discrete mathematics – foundations, but also number theory.
  • Logic can be expressed very concisely in logic programming languages such as Prolog.
  • People who use R do not use it similarly to Matlab. It can do all sorts of crazy things like generate LaTeX documents (using Rmarkdown, which can do Word, or HTML, or Markdown, or...) contain embedded C++, etc etc. Comparing the statistics you can do in R to Matlab is like comparing the best linear algorithms you can do in Matlab to the ones a first-year student who has learned Gaussian elimination can do. – David Roberts Aug 23 at 0:33
  • @DavidRoberts as I said I don't know much about R. Feel free to edit in anything you feel should be known about it. However, I assume that the features you mention don't really have much to do with the design of the language itself but simply with libraries you can invoke? In that it wouldn't be too different from Python. (Or Haskell, which has the benefit of libraries as strongly-typed eDSLs. FWIW I myself write all my LaTeX documents and screen presentations in Haskell, and one of the top document conversion tools is basically just a wrapper around a Haskell library.) – leftaroundabout Aug 23 at 9:22

More and more I am becoming convinced that one should know at least one programming language very well as a mathematician of this century. Is my conviction justified, or not applicable?

All of the answers so far seem to pass over this initial question. While it's true that a much larger percentage of mathematicians nowadays do calculations on computers etc, I do not agree with the sentiment that every mathematician should learn a programming language. (There's also the question of what this means: e.g., do I know Python if I can use it as a calculator, or do I know Python if I can write my own web browser in it?)

Certainly being able to program has many uses, and also is a marketable skill outside of academia, but just as there are many kinds of math there are many kinds of mathematicians.

Here are some of my reasons for disagreeing:

  1. Learning how to program (and program properly) takes time. For many mathematicians, that time may be better spent thinking about mathematics proper.

  2. If one ever needs to do some simple calculations, there are many mathematical software packages mentioned in other answers that can be effectively used without learning how to properly program in the relevant language (e.g., based on tutorials one can do simple calculations with elliptic curves in Sage without knowing anything about Python).

  3. Even if one is interested in serious calculations where based on the mathematical software available some serious programming is needed, it may be more efficient (and beneficial) to strike up a collaboration with someone who works on computational mathematics.

  4. I know many successful mathematicians who do not program.

  • 4
    In response to the charge that learning programming takes time, I would agree. But if your research requires, a few times a year, that you find the determinant of a 4x4 matrix, or compose a quadratic polynomial with itself three times, it will quickly give you savings in time. – PrimeRibeyeDeal Aug 21 at 16:06
  • 3
    @PrimeRibeyeDeal But to do simple computations like that doesn't actually require (properly) learning a programming language. (I personally found learning things like Python very useful, but my point is I don't think it's necessary for all (most?) mathematicians.) – Kimball Aug 21 at 17:14
  • 5
    You don't need to properly learn a programming language to make use of it any more than a grad student must properly learn their whole field before diving into research. The more you know, the better, but the scarcity of time affects both situations. I never properly learned Python/Sage, but just continually learn just enough to do this task and then just enough to do that task...and sooner or later one becomes proficient. But I can agree with you that it need not be wise for a mathematician to devote the time to properly learn a language. – PrimeRibeyeDeal Aug 21 at 17:32
  • @PrimeRibeyeDeal, with WolframAlpha it may not be necessary to learn a whole programming language for tasks that simple.… is straightforward, and you might get to… with trial and error. – Matt F. Aug 24 at 3:30

I'll start with a meta-answer: given the large (and growing) number of programming languages out there, how do you decide where and how to invest your time?

The answer turns out to be quite simple, but not necessarily what you think. It's not the syntax, the speed, the functionality, or any of the things that people normally talk about - the tech specs are for sure important, but they're secondary for your decision making process. What actually matters the most is the community and ecosystem around the language. You should ask "What are the people who are doing the kind of thing that I want to do using?" and you should use that, even if you have to learn new stuff. There are many reasons:

  • Languages with a vibrant ecosystem get easier, faster, and more powerful over time, and they are optimized for the purposes for which the community uses them (often the users are also developers).
  • When you get stuck - and you definitely will, no matter what you're using - you are more likely to get quick and useful feedback if there is a big and active community than straight from the developers. Especially when you first start out you are likely to make mistakes that other people have made, and if those people are like you then they will be able to understand what you are trying to do and speak your language.
  • When there are a lot of blog posts / stackexchange questions / github examples to look at you will learn faster and it will be easier to keep up with new features / integrations.

Having meta-answered the question, I will now try to actually answer it. According to the above, I think your question reduces to "What languages have the most active communities of professional mathematicians using them?" It's hard to answer that empirically, but at the time of writing my impression is that the main contenders are:

One way to figure out which one is right for you personally is to use Github's trending repositories feature and look for projects that others have done which are closest to your interests.

  • popularity does not indicate fitness for purpose, but signals catering to the lowest common denominator... – hkBst Aug 21 at 18:18
  • 4
    @hkBst The thing is: mathematicians are the lowest common denominator in the domain of software engineering. If you want to use the most powerful tools out there then you will find yourself spending 80% of your time worrying about build tools, unit tests, docker containers, cluster management, parallel processing, GPU optimization, etc. because the best tools are designed with those considerations in mind. If you want to focus on algorithmic design and problem solving, then start by looking at what people solving similar problems under similar conditions are doing. – Paul Siegel Aug 21 at 18:43

Mathematica is a full language which is great for solving mathematical questions.

  • It works most impressively as a functional language or for the application of rules
  • You can also do the typical imperative programming with Do loops, If-Then statements, arrays, the Set statement for assigning a value to a variable, and file input and output.
  • You can also create mathematical expressions, integrate and differentiate them, plot them, do parametric plots, graph f(x,y) in 3D, download webpages, and create interactive programs (the simplest ones are made with Manipulate).
  • Mathematica also has access to large curated databases (English, Chemistry, Geography, Meteorology, Astronomy,...) and a large number of statistical tools including some for machine learning and neural nets.

For more check out What's New in Mathematica 11.

I find Mathematica easier to work with than Python, but Python can do most of what can be done in Mathematica. Python Jupiter Notebooks are similar to Mathematica notebooks but not as capable. On the other hand, Python is OPEN SOURCE, FREE, and, with some work, it can be compiled (See PyPy and Cython). Mathematica has more limited options for compiling though it is not hard to link Mathematica code to Java code.

  • 6
    I personally dislike Mathematica, but I don't see what's wrong with this answer that it collects so many downvotes. – Manuel Bärenz Aug 21 at 10:26
  • 9
    @ManuelBärenz It reads a bit like a spam advert is probably why. Otherwise, some might not like it since it is not open sourced (which means at some level you are simply trusting there are no bugs), not freely available (so you can't even use it on your university computers if they don't have a license for it) and that it seems primarily useful for handling and processing large masses of data rather than more heavily abstracted matters like category theory and group theory (which are pretty popular around here). – zibadawa timmy Aug 21 at 10:34
  • 1
    @zibadawatimmy the recent stuff has some cool basic theorem-prover capabilities. I personally like mathematica for discrete math - the documentation is great and the language is extremely consistent. The downside is that the error-messages are hard to track down (no line numbering!). – Per Alexandersson Aug 21 at 16:55
  • Python can't really be compiled, at least using the standard interpreter. The .pyc files it generates are a translation into a very high-level bytecode that's basically just a parse tree for the original .py file. (There's very little performance improvement from compiling is my point.) – Elliot Gorokhovsky Aug 22 at 18:07

Make sure you have a good look at Julia, this is a relative new language (some 8 years now) that is primarily aimed at quantitative/ scientific computing. Version 1.0 was just released.

Julia is best known for its Differential equation solvers and its constrained optimization DSL/solvers and its automatic differentiation and linear algebra packages. The last two of which make it great for machine learning.

It is simple yet fast (without having to resort to external compilers like Numba in Python).

Not so much a programming language in the classical sense, but a graphical language that is still in its baby shoes: Globular. You can define and manipulate some kind of globular higher categories (Jamie Vicary calls them "semistrict categories") and formalise theorems therein.

Right now it's not necessary to know Globular (or any similar tool like Opetopic), but I hope and believe that graphical tools for calculations and verifications in higher categories will be used more in the future. Regardless, if you're working in the field of higher categories, you should at least know of the possibilities and limitations of such tools.

  • 4
    ....Which affects, like, the 0,001% of the mathematics community – Qfwfq Aug 21 at 10:21
  • @Qfwfq, that's your subjective impression, I take it? – Manuel Bärenz Aug 21 at 10:26
  • 3
    @Qfwfq Although it might not be a wonderful answer for the title question, the text certainly adds appropriate qualifications. The language is still pretty new, and a number of people I know who work with higher categories seem to appreciate it. – Todd Trimble Aug 21 at 12:33
  • I wasn't implying the answer wasn't good: it's surely appropriate and good. Was just making some silly irony on the fact that the community needing opetopic computations is probably quite small.... ;) – Qfwfq Aug 21 at 21:35

For those who have a particular interest or motivation (symbolic computation, logic programming, statistics, numerical analysis, data exploration, structure representation, conjecture mining), there are people who have worked with or developed systems to address items related to that interest or motivation. Many other answers to this question refer to python, SAGE, Ocaml, Haskell, R, and other languages, and there are references and tutorials for these to help one learn how to program in these languages.

Lacking such a specific interest or motivation, what should one do? I say, learn AWK!

Programming professionally is a discipline which requires a lot of specialized knowledge and training. Much of the time, mathematicians who are not also professional programmers "program as needed": they write the code and do the amount of testing and execution needed for a specific result, and the code written often does not get reused or extended on more than a very small scale. Those who develop libraries and systems for use by others operate with code reuse on a larger scale, but for many of these systems, the domain of application and the user base number at greatest in the thousands , if that. As a result, a lot of specialization occurs because of the specific needs of the user base. Many languages evolve toward meeting these specific needs with constructs and methods that take time and energy to learn.

What if you don't know what specifics to learn? Start with AWK, I say!

AWK is a system that is used for string processing. It is also capable of numeric processing. Its control constructs are a simplified version of constructs in C, and it has almost no typing. Everything is a string, or an integer or an associative array, with facilities for converting easily between these types, and with nice defaults for initialization.

AWK is very good for rapid prototyping and high level design. The development environment is not much larger than the size of the text editor and is easy to install. One can ignore a lot of the file processing features and just use a BEGIN{} block to encapsulate a program without learning about regular expressions and patterns.

Why do I suggest AWK? It has a simple subset of quickly learned constructs that make it easier to use than many general purpose languages, including the ones I've listed above. It allows you to consider problems from a general perspective without confronting you with many language-specific implementation details: if you can store your data as a number or a string, even in a file, AWK can process it for you. The associative array implemented by AWK is also easy to use and aids in high level development. Most importantly, the time and energy needed to make a working prototype are low. Once you have an AWK prototype, you can then choose to go to another language for performance or other implementation specific concerns, for the prototyping process will make those concerns explicit.

In summary, start with AWK. That will help you understand how to do basic programming, and will give you a start on deciding what more specialized programming you want to do.

Gerhard "Everything Is A String, Right?" Paseman, 2018.08.21.

  • 1
    ``Unfortunately, it turns out to have been designed at a bad spot on the complexity-vs.-power curve. The action language is noncompact, but the pattern-driven framework it sits inside keeps it from being generally applicable — that's the worst of both worlds.'' --Eric Raymond – hkBst Aug 22 at 9:17
  • Eric Raymond's quote is from a chapter on minilanguages, and is intended to guide designers of new minilanguages. It would seem learning enough AWK to avoid some of its pitfalls (which are cultural, not technical) in designing a new minilanguage is useful. My perspective is that (a subset of) AWK is useful as a starting point with an almost flat learning curve. Having written and seen several standalone applications with AWK, I challenge the part of the quote about applicability. I think you should find a better response. Gerhard "Not Asking For Minilanguage Designers" Paseman, 2018.08.22. – Gerhard Paseman Aug 22 at 15:14
  • AWK is great - it saved me from learning the abomination that is PERL. – Igor Rivin Aug 24 at 20:32

It used to be APL. These days it can be J (which is a successor to APL).

If mathematicians would care (as we should!) to add something like respective libraries then Forth would be a great fun.

  • @Martin, thank you for the links! – Wlod AA Aug 21 at 8:23
  • 2
    You're welcome. I thought that including at least Wikipedia links is possible a useful thing to do - somebody unfamiliar with those languages has a quick way to ind at least to some basic information. – Martin Sleziak Aug 21 at 8:26

I know it's not free, but magma is an amazing piece of software.

It is completely invaluable for me for algebra. It comes into its own when dealing with multivariate polynomials, Galois theory, commutative algebra, group theory, Lie theory ... I am not an expert on these things, but I understand it regularly wins Groebner basis calculation competitions for example.

I also feel that the interface is a bit cleaner than other software I have used. If I return to magma after not coding for a while my "time to regained fluency" is about half a day. I can't say the same for GAP for example.

  • It IS free in the US. – Igor Rivin Aug 24 at 20:30
  • @IgorRivin - How do I get magma for free? This page suggests that it is not free: – Dustin G. Mixon Aug 25 at 22:56
  • 1
    @DustinG.Mixon If you are at a US university, you get Magma paid for by the Simons Foundation (praise be upon them). So, you write to the magma people, and they tell you to ask your department's magma contact to write to them. If you don't have one (inconceivable for OSU), just volunteer to be one. Then, the administrator gets you magic tokens. – Igor Rivin Aug 26 at 20:43

One of your questions is: What languages should someone aspiring to be a mathematician learn?

For an aspiring mathematician -- learn a language that is useful to you outside of academia, since most people who get PhDs do not end up working in academia. Since you could well end up in data science, Python and R are good choices for this, and as it happens Python also seems to be the consensus answer for mathematical research.

You should know Maxima. It is free, easy to install on a wide range of platforms, and has a wide range of mathematical methods - take a look at the manual.

  • 4
    Chris, welcome to MO. You might want to elaborate more on Maxima. As it is, it's a bit hard to gain any insights from your answer. – Amir Sagiv Aug 21 at 12:53

I think programming by itself, except on related areas, will not be helpful to a working mathematician. On the other hand, programs called CAS (Computer Algebra System) such as Axiom, Maxima, Magma, Maple or Mathematica; may help intuition in many situations. If you still do not know some of them I recommend take a look. The former three are free the latter two are paid.

You will have to choose:

Do i want to program arrays, pixels, and compile standalone apps? do i want to use limited xy graphics and start nice and simple?

A language is more descriptive than maths, maths is a script, so it doesnt stream data into graphic forms, it doesnt have time and debug. You will have to make concessions to a framing language, to describe how you want maths to be streamed, memorized, displayed, debugged.

I'd say start obsessively and simply with a language that draws you in by it's fast results. You may find your brain suddenly expands in a strange way due to the breadth and depth of a new power to program anything you want, when you have written/understood your first 50 lines, which is all it takes to decide to continue...

You can specialize in anything your career draws you to, so CUDA/glsl if you want to do parallel processing and supercomputing, its very vogue, and specialized. has 3d stuff, and vironoi, noise, graphics.

Matlab for pure maths, personally i found it cumbersome and dry.

c# for DSP, FFT, GameOLife, Algorythms, in unity3d is a fun environment. Paul bourke is a renowned mathmatician, dont know his primary code. C#?

Stuff like wigner quantum audio time frequency distribution or fractals are mostly in C family for legacy journal eork, thats why i like c#.

Some people do in depth topologies on openscad, like kitwallaces pages...

And k3dsurf has isosurface descriptions which are a bit futile but amazingly clever. Its pure trigonometry volumes only language.

K3dsurf and openscad are starter languages which can be learnt in 2 hours/days.

I learnt on reaktor visual math environmeht, then milkdrop, then javascript and scad.

Java isnt great these days, memory concerns, it used to be a top choice.

  • 1
    I don't think that this answer addresses very well the OP's requirements: "In particular, this language should be very useful for mathematics applications, should be close in syntax and structure to mathematics, and be mathematically related in other relevant ways." – Yemon Choi Aug 22 at 1:02
  • 2
    Mathlab is incomprehensible to a mathmatician. to integrate logic with maths, a framing language syntax is necessary. Mathlab is terse, and its less of a language than C, it's more of a script. It cant be compiled into a program. I made the same recommendation as a highky upvoted answer: C# due to its legacy in maths algorythms. K3dsurf is pure maths, scad is pure geometry, ... a programming language is not a scripting language. Mathlab is incomprehensible to a mathmatician., to integrate logic with maths, a framing language syntax is necessary. C family is vry OO-complex. C# is a language, – com.prehensible Aug 22 at 2:46
  • Mathematicians are naturally top programmers. It takes them as long to learn mathlab as python. – com.prehensible Aug 22 at 2:59

protected by Community Aug 22 at 10:18

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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