What programming language should a professional mathematician know? 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.
 A: 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.

A: 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.

A: 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). 
A: LaTeX
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.
A: 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.
A: 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 http://katlas.org/wiki/The_Kauffman_Bracket_using_Haskell, 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.

A: 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.






A: 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.
A: 
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 also 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.
A: 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.
A: 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.
A: 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:


*

*Sage (previously mentioned)

*Julia

*R

*Matlab
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.
A: 
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:


*

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

*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).

*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.

*I know many successful mathematicians who do not program.
A: 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.
A: 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.
A: 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.
A: 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.
Shadertoy.com 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.
A: 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.
