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.
Axiom was a commercial competitor to Mathematica and Maple. Axiom was originally developed at IBM Research. The mathematics of Axiom is based on group theory (Groups, Rings, Fields, etc). The language (Spad) is extremely strongly typed. You can have Polynomial(Fraction(Integer)), that is polynomials with fractional coefficients. Or Fraction(Polynomial(Integer)), that is fractions with polynomials in the numerator and denominator. You might find it interesting.
It looks nice, Tim. How does it compare to Maxima?
Wow. Great interface! Heard of most of the languages but didn’t try them out personally. Coq is an interesting concept but perhaps not practical for a regular math student trying to check their proofs. Python is definitely a strong choice, and can be even used for the purpose of marketing automation. It would be interesting to see how the future can leverage those into building more user-friendly platforms without compromising functionalities of programming languages. Thanks!
nice
currently i i did my own maths and than i desire to register how can i do that number two i wish i can create my own programming
Awesome post.
Keep up the good work.
I would add F# to the list…
Thanks for the post.
Just fantastic. I can’t really think of a language that is missing, except perhaps C (not C++).
Since C can be natively integrated into almost any language (Mathematica, Matlab, Julia, Python, Java, Haskell, Prolog & R) it is great if you plan to reach a large audience, especially for performance mathematics. Projects that come to mind: Arb (Interval arithmetic library), GMP, MPFR, FFTW (Fast Fourier Transform).
C is however not good for symbolic manipulation, which require powerful languages in my opinion.
Fortran might be an alternative to C, but it is outdated.
Its really an fascinating post and i’m thinking to start with julia because im familiar with python and R .
Maybe Zig instead of C?