Top 6 Programming Languages for Mathematics

PolyMaths
5 min readMar 23, 2023

--

Any one who is interested in mathematics or plans to study it, should have at least some fluency with programming languages. Not only will you be more employable, you will also be able to understand and explore the mathematics in a deeper way. So what languages should you learn?

1. Python

Python is a fantastic language for anyone who is learning mathematics. It’s syntax is easy and intuitive — it almost sounds like you’re typing in English!

Python is object-oriented, meaning you can create ‘objects’ which are like nouns that have a state and can have methods called upon them to be manipulated. Python also has a vast range of libraries that can be imported and provide you with graphing and plotting features (see matplotlib or numpy ) and even algebraic manipulations using sympy .

Overall, a perfect language for beginners but still extremely powerful.

2. MATLAB

One of the costs of Python is that it is relatively slow — you won’t notice it for many programs, but it definitely can become inconvenient once you start running longer programs.

MATLAB has the benefit of an easy syntax while also sending heavy computations to its backend languages — Fortran and C, which are computationally a lot more efficient. This means you get the power of C without having to learn its difficult syntax.

MATLAB is also designed specifically for mathematics, so it is easy to create graphs or 3D figures, as well as a much more natural computer algebraic system.

One of the downsides is that finding help is a little tricker than Python as the community is not quite as large. However, this is just a small cost for benefits!

3. Julia

Julia is a language designed from the beginning for high-performance computing. It’s dynamically typed, like Python, which makes it a lot easier to write with and supports both object-oriented and functional programming paradigms.

It’s a relatively new language, created in 2012, but combines a lot of different benefits from many different languages in one. In the words of the founders:

We want a language that’s open source, with a liberal license. We want the speed of C with the dynamism of Ruby. We want a language that’s homoiconic, with true macros like Lisp, but with obvious, familiar mathematical notation like Matlab. We want something as usable for general programming as Python, as easy for statistics as R, as natural for string processing as Perl, as powerful for linear algebra as Matlab, as good at gluing programs together as the shell. Something that is dirt simple to learn, yet keeps the most serious hackers happy.

Why We Created Julia

4. Mathematica

As you may have guessed from the name, Mathematica is program designed specifically for mathematicians by Stephen Wolfram. Many people are familiar with the smaller online version, Wolfram Alpha, but Mathematica is much more powerful.

Mathematica’s computer algebra system is built right in and is so easy to use. Any letter is automatically considered an algebraic variable, so you don’t even need to declare these explicitly like in Python or MATLAB.

Mathematica uses a ‘notebook style’ interface which allows for figures and results to appear right alongside your code!

Mathematica also excels at technical and high-performance computing across a range of fields including machine learning, image processing, function visualisation, and geographic computing.

One of the drawbacks is that unlike the Python and Julia, Mathematica does come at a cost. However, if you’re affiliated with a university, you may be able to get a license from them for free.

5. R

Most students of mathematics also work a lot with statistics or data, and R is one of the best languages for this. R excels not only at processing data, but also at presenting it and creating beautiful and colourful visualisations.

R also has a ton of libraries that other users have made which allow it to be a very flexible language that can be used in many different contexts. One of the most common is ggplots which can create figures such as this one:

R can also handle computationally-intensive tasks by linking C, C++ or Fortran code and calling it in the programming at run time.

R is also great for reporting and creating documents. Packages such as knitr or RMarkdown also allow it to integrate with LaTeX code. This brings us smoothly to our last language!

6. LaTeX

LaTeX is a typesetting language used for creating documents — it is especially useful for communicating mathematics or other scientific subjects.

It’s different from the other languages in this list in that it is not meant to be used for computing integrals, running simulations or processing data. However, it’s still incredibly useful and used by most mathematicians on a daily basis.

Anyone who has tried writing a mathematics-heavy paper using Microsoft Word will know that it’s not the best program for the job. There’s a little bit of a learning curve to adjust from Word to LaTeX but once you’ve passed it the benefits are proportional!

If you’re interested in learning how to write up your first LaTeX document, check out my article here. You should be able to get your first document finished by about 15 mins!

--

--