Maths - behind the scenes

Programming is a piece of cake

When I think about famous mathematicians born in previous centuries, I imagine a handsome young man (well, my gender-biased imagination probably confirms the statements from my last article). He is sitting under a blooming tree with a quill and a scroll of parchment covered with equations. I must have lumped together mathematicians and poets, with the romantic charm.

With this image in mind, eighteen-year-old Paula went to her first lecture at the Faculty of Mathematics, Informatics and Mechanics (University of Warsaw). Full of expectations that I would do great things in the field of mathematics, I started copying down the words from the blackboard. “Baking a cake – the algorithm” – this is what they said. Was that a joke? No, just Introduction to Informatics.

You might wonder why such a course was obligatory for first year mathematics students. We just need a pen, a piece of paper and a great mind, right? Not quite. We can stay away from computers if we want to focus on abstract algebra or number theory. However, things get much more complicated if we would prefer to actually apply maths to other sciences. Like to weather prediction.

Lewis Fry Richardson tried to predict the weather on 20 May 1910 by hand. Don’t get me wrong, I admire his attempt, he was one of the pioneers of the weather prediction. Having said that, I am happy that scientists have developed more sophisticated techniques; Richardson failed quite badly.

Other examples? The model I am working on involves simulating the behaviour of population of worms. Without a computer I would have to give up, it is just impossible to calculate by a human being, not to mention more complicated systems, such as climate models.

The world of Four Colour Theorem (source: wikipedia)

Computers even help us prove actual theorems from pure maths, for example the famous Four Colour Theorem. One of versions of this theorem states that any political map can be coloured using only four colours (or even less). The rule is that no bordering countries can have the same colour. The statement is very simple but the only way to prove it was to find all the possible configurations of countries (we are not talking about the existing countries but every map you could draw). I am pretty sure that without computers authors of the proof, Kenneth Appel and Wolfgang Haken, would be still checking all the possibilities.

I hope you understand now why the computers are so essential in mathematicians’ work. But what do they actually do for us and what does the cake mentioned in my first lecture have to do with maths?

Computers are like dogs and programming is just instructing the puppy to sit/stay/stop-stealing-my-favourite-socks-so-that-I-have-to-chase-you. You must know what you are given (input or your dog’s personality) and what you want to achieve (output or yay-I-can-wear-my-lovely-blue-socks). Anything in between is called the algorithm. Believe me or not, you are using algorithms every day. A recipe to bake a cake is one of them. Or your morning routine. When you forget one of the points or switch the order, you might have to eat a slack-baked cake or be late at work. Algorithms structure how we think about the problem.

How do we tell the computer what it is supposed to do? First we need to know in which language we are comfortable communicating. We can learn programming languages in similar way as we learn German or Spanish. The all have specific words, syntax etc. It takes practice to become fluent in one of them. And even if you are almost a native, you still need to consult a dictionary once in a while.

The problem with programming is that the computers are, paradoxically, very stupid. This is my personal view and I hope my laptop won’t take revenge on me for saying this (I still have to finish my project!). Why do I think so? If you confuse words in a foreign language, there are good chances that you will still be understood (unless you ask someone to turn you on, confusing it with turn around, which happened to me once). Computers just take what you give them and do not think. If your code is not working, it is entirely your fault. They will not try to guess what you wanted to do — do not count on their empathy. Life is brutal (and computers definitely are).

The first time you see a code – the instructions for the computer – you might be very surprised. It took me a while to accept that it is ok to write “a=a+1”. It means that we add 1 to a variable called “a”. Although if you accept “taking something with a pinch of salt”, why would you struggle with programming? We do not have to take everything literally!

I definitely think programming is a useful skill to acquire – and an essential one when you are a mathematician or a scientist. It can be hard, it can be exhausting. But trust me, the day when I managed to persuade my computer that I know what I want – and when I got it – was one of the best moments in my life. So keep calm and hello world!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s