As someone who is passionate about both mathematics and programming languages, I thought I would share what I consider to be 10 great programming languages for mathematics.
I aimed for variety in doing so, to give you a broad spectrum of approaches to programming and problem modeling.
The language descriptions are straight from their respective sites or wikipedia pages, but I’ve added my two cents throughout the list as well.
1. WOLFRAM LANGUAGE
The Wolfram Language is the programming language of Mathematica and of the Wolfram Programming Cloud.
It is a general multi-paradigm programming language developed by Wolfram Research. It was designed to be as general as possible and emphasizes symbolic computation, functional programming, and rule-based programming.
The language is very large, touching on numerous domains, often specialized.
MY TAKE
It’s a decent functional, rule-based, programming language that handles symbolic computation extremely well. That said, I don’t find it to be particularly elegant, as far as programming languages go.
Its real value lies in its huge multi-domain standard library, which is, particularly for mathematical applications, years ahead of virtually any other programming language in the world. Watch their demo and chances are you’ll be impressed.
2. MATLAB / GNU OCTAVE
MATLAB (matrix laboratory) is a multi-paradigm numerical computing environment and fourth-generation programming language.
A proprietary programming language developed by MathWorks, MATLAB allows matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages, including C, C++, Java, Fortran and Python.
MY TAKE
Hard to beat for numerical computing. Consider the open source alternative implementation/clone, GNU Octave, as well.
3. R
R is a programming language and software environment for statistical computing and graphics supported by the R Foundation for Statistical Computing.
The R language is widely used among statisticians and data miners for developing statistical software and data analysis.
Polls, surveys of data miners, and studies of scholarly literature databases show that R’s popularity has increased substantially in recent years.
4. COQ / GALLINA
Coq is an interactive theorem prover. It allows the expression of mathematical assertions, mechanically checks proofs of these assertions, helps to find formal proofs, and extracts a certified program from the constructive proof of its formal specification.
Coq works within the theory of the calculus of inductive constructions, a derivative of the calculus of constructions.
Seen as a programming language, Coq implements a dependently typed functional programming language, while seen as a logical system, it implements a higher-order type theory.
Coq provides a specification language called Gallina. Programs written in Gallina have the weak normalization property – they always terminate.
5. PROLOG
Prolog is a general-purpose logic programming language associated with artificial intelligence and computational linguistics.
Prolog has its roots in first-order logic, a formal logic, and unlike many other programming languages, Prolog is declarative.
The program logic is expressed in terms of relations, represented as facts and rules. A computation is initiated by running a query over these relations.
6. HASKELL
Haskell is a standardized, general-purpose purely functional programming language, with non-strict semantics and strong static typing. Haskell features a type system with type inference and lazy evaluation.
MY TAKE
One of the hardest languages to grasp for non-functional programmers, its learning curve is well worth the effort. Its side effects-free, purely functional nature makes it quite suitable for modeling mathematical problems. It will be of particular interest to those who deal in category theory and programming language research.
7. IDRIS
Idris is a general-purpose purely functional programming language with dependent types. The type system is similar to the one used by Agda.
The language supports interactive theorem-proving comparable to Coq, including tactics, while the focus remains on general-purpose programming even before theorem-proving.
Other goals of Idris are “sufficient” performance, easy management of side-effects and support for implementing embedded domain specific languages.
MY TAKE
Research language. It combines elements of Haskell and Coq. Quite interesting.
8. JULIA
Julia is a high-level, high-performance dynamic programming language for technical computing, with syntax that is familiar to users of other technical computing environments.
It provides a sophisticated compiler, distributed parallel execution, numerical accuracy, and an extensive mathematical function library. Julia’s Base library, largely written in Julia itself, also integrates mature, best-of-breed open source C and Fortran libraries for linear algebra, random number generation, signal processing, and string processing.
MY TAKE
A very promising language for scientific computing and data science. Thanks to the Jupyter project, Julia is also available as executable notebooks.
9. PYTHON
Python is a widely used high-level, general-purpose, interpreted, dynamic programming language.
Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than possible in languages such as C++ or Java.
The language provides constructs intended to enable clear programs on both a small and large scale.
Python supports multiple programming paradigms, including object-oriented, imperative and functional programming or procedural styles. It features a dynamic type system and automatic memory management and has a large and comprehensive standard library.
MY TAKE
What makes Python interesting from a mathematical and scientific standpoint is the extensive amount of relevant libraries that are available for this popular programming language (e.g., numpy, scipy, scikit-learn, Sage, etc).
Thanks to this rich ecosystem, you get an easy to learn, nice language that is great for scientific computing. And since it’s popular, examples (and Jupyter notebooks) are available far and wide.
10. J
J is a very terse array programming language, and is most suited to mathematical and statistical programming, especially when performing operations on matrices. It has also been used in Extreme Programming and network performance analysis.
Like the original FP/FL languages, J supports function-level programming (not the same as functional programming) via its tacit programming features.
MY TAKE
J, like APL and K, is a mind-bending language. It is terse and hard to read at first, but also incredibly powerful. Well worth experimenting with if you are interested in new ways to approach data manipulation and analysis.
This is an implementation of quicksort, just to give you an idea of what we are dealing with here.
quicksort=: (($:@(<#[) , (=#[) , $:@(>#[)) ({~ ?@#)) ^: (1<#)
Pretty wild.
So there you have it, 10 great programming languages for those interested in mathematics. Other valuable options exist, of course, and I’d be interested to hear more about your personal favourites in the comments below.