## Programming Languages

Many pupils studying A-Level Mathematics will be wondering if it is worth learning a programming language, and whether this can help with their studies and their future employment. Most people have now heard of Artificial Intelligence (AI) and the Internet of Things (IoT), and with the proliferation of connected devices and ever-faster computer processing, there has been an explosion of data collection and analysis. AI, analytics, automation, data science and robotics are all changing the way we work and that’s why more and more employers are seeking mathematicians who can program.

## The Importance of Learning To Program for Maths Students

In 2018, an independent review of knowledge exchange in the mathematical sciences was published^{,} and amongst its many findings was the recommendation that “*All mathematics students should acquire a working knowledge of at least one programming language*.” In February 2021, according to the Popularity of Programming Language Index, the top five ranked languages were: 1. Python^{TM} (30.06%); 2. Java (16.88%); 3. JavaScript (8.43%); 4. C# (6.69%) and 5. C/C++ (6.5%).

## Which Programming Language Should a Mathematician Learn?

The obvious question for mathematicians then is “Which programming language should I learn for Mathematics?” Luckily, the answer to this question is Python! Readers should also be aware that there are other fantastic specialist mathematical software packages, for example, Maple^{TM}, Mathematica^{®} and MATLAB^{®}, which are all extremely powerful and used by most universities and some industries around the world. I also want to point out that programming can be fun and it is the only means to solving the majority of real-world problems!

## How Do I Get Hold of Python?

There are at least two ways to get started with Python for scientific computation. The first main way, is by downloading Anaconda, a free open-source distribution of Python and R (statistics). Within the Anaconda Navigator you can launch Spyder (Scientific Python Development Environment) or a Jupyter notebook. Within these environments you can use Python as a graphing calculator or you can create your own program files. Downloading Anaconda means that you will be saving software on to your computer and it will take up some memory. The advantage with this method is that you do not need the internet to program with Python.

The second main way to get started with Python is by using Google Colab, which enables you to perform cloud computing using Jupyter notebooks. The advantage with this method is that you do not need to download any software on to your computer. There is also the added advantage that you can work collaboratively over the web and save your files in GitHub, which is used by many employers around the world. Others encounter Python through using a Raspberry Pi computer.

## How Do I Learn Python for Mathematics?

There are various ways to teach yourself programming including studying A-Level Computer Science and learning from books and online courses. In order to learn Python for Mathematics, I recommend my own workshops “Python for A-Level Mathematics and Beyond.” These national workshops are run twice a year with the Institute of Mathematics and its Applications (IMA), twice in January and twice in July.

The itinerary for a workshop is as follows: In the first hour, delegates are shown how to use Python as a powerful calculator. After a short coffee break, delegates are then introduced to symbolic computation with the sympy library. After lunch, numerical Python with the numpy library and plots with the matplotlib library are covered. The final session is concerned with programming using Jupyter notebooks and Google Colab. Delegates are shown how to: (i) define a function (like adding a button on your calculator); (ii) construct for and while loops, and (iii) write if, elif, else constructs. I have written a Jupyter notebook that shows how Python covers the whole of the A-Level Mathematics syllabus.

## Will I Need Python at University?

In this technological age, programming is undoubtedly a skill that will be in high demand at university, not only in Mathematics, but in most other subject areas at the tertiary level. At Manchester Metropolitan University (MMU) we have been teaching a programming-based Mathematics curriculum for over twenty years. This has proven to be incredibly popular with our students. There are over 38,000 students at MMU studying on over 500 courses. Since the launch of the Student Union teaching awards in 2011, Mathematics has been shortlisted on seven occasions, winning the award in 2020, 2018 and 2012.

As part of extracurricular activities, each summer I hold a workshop entitled “Python for Scientific Computation and TensorFlow for Artificial Intelligence,” for undergraduates, postgraduates, technicians and academic staff across the whole university. TensorFlow is an end-to-end open-source platform for machine learning, deep learning and AI written in Python. This workshop is extremely popular and is a great way for undergraduates and others to deepen their Python knowledge. I have been invited to run it nationally and internationally in China, Malaysia, Singapore and the USA.

## Will Python Help Me With Employment?

The simple answer is YES. Pretty much any industry that you care to mention will use some sort of programming, and even if they do not explicitly use Python, once you have learnt one programming language it is much easier to pick up another one. There is a web page dedicated to Python Success Stories, where the reader can find an extensive list classified by application domain. Data Science is also one of the fastest growing career areas for maths undergraduates, and this type of role frequently requires skills in Python.

Article by Dr Stephen Lynch SFHEA FIMA, Manchester Metropolitan University

#### Image Credits

Featured image 1840151sudarshan, CC BY-SA 4.0, via Wikimedia Commons

“Raspberry Pi Closeup” (CC BY 2.0) by Gijs Peijs