Plus Blog

January 29, 2014

It might be grey and raining outside, but inside the Museum of London and Barnard's Inn Hall, Gresham College have some fascinating lectures planned to brighten the darkest day! First up Caroline Crawford will explore the lives of stars on Wednesday 5 February at 1pm at the Museum of London, how they are born, evolve over billions of years and dramatically burn, revealing clues to our own origins. It seems Hollywood isn't the only place where the stars crash and burn.

Frog prince

Prince Charming? Or just a slimy toad?

And surely the best way to cheer up a dreary day is to fall in love. Tony Mann will explain the mechanics of computer dating and how maths can help us find our heart's desire (or at least a charming dinner companion) in Finding stable matches: the mathematics of computer dating on Monday 17 February at 6pm, at Barnard's Inn Hall.

And if you are using a coin to decide whether to get out of bed or stay under the duvet, you need to hear what Raymond Flood has to say about Probability and its limits on Tuesday 18 February at 1pm at the Museum of London. He'll explain why we know a coin will come up heads roughly half the time over many tosses, but we can't tell you whether yours will land heads or tails tomorrow morning. If it lands heads and you make it to his lecture, you'll find out much more!

There's no need to register for these free public events, just come a bit early to get a seat. You can find out about all the other fascinating talks on the Gresham College website and you can get in the mood by reading about astronomy, dating and probability on Plus.

January 23, 2014
Coins

Vending machines that don't return change are annoying, especially if the prices they demand aren't nice round figures you can make up with a single coin. If that's the case, then there's nothing but to cram through your wallet, fishing out the right coins to make up the amount exactly. What's the best way of doing that? Without noticing many of us probably follow this recipe: find the biggest (as in largest denomination) coin that fits into the amount, then the next-biggest that fits into the remainder, and so on, until you (hopefully) hit the required sum. As an example, if you're being asked for 85p, you probably fish a 50p coin out first, then a 20p coin, then a 10p coin, and finally a 5p coin. And what if you haven't got all of the coins just mentioned in your wallet? In that case you follow the same recipe using what you've got.

This greedy recipe (greedy because you always go for the biggest coin that fits) seems to offer the best solution in that it seems to involve the fewest number of coins to make up the amount you need. For example, supposing you do have a 20p coin, but decide for to go for two 10p coins instead, you increase the number of coins to make up 85p from four to five. So the greedy algorithm seems useful, not just for people struggling with vending machines, but also for cashiers returning change to customers.

But is greed really always the best option? It turns out that this depends on the coins that are available. Imagine, for example, you need to make up 8p. Greed would tell you to go for a 5p coin, then a 2p coin and then a 1p coin. And that's indeed the smallest number of coins to make up 8p with if you are using Pound Sterling, Euros, US Dollars, and most other currencies. But now imagine a currency that in addition to these denominations also has a 4p coin. Then you could make up 8p with two of those, beating the greedy strategy by one. Such a currency system might seem silly but it's not unheard-of: the pre-decimal British coinage system was one for which the greedy recipe failed when it came to minimising the number of coins needed to make up a given amount.

2 comments
December 24, 2013
Will the presents fit?

Santa's just putting his hat on and button up his jolly red coat when an exasperated elf runs up to him: "Santa! We've got a problem! There have been so many good children this year we can't put all the presents into your sleigh!"

The problem is that Santa's sleigh has a weight limit, and can only carry 2 tonnes of present. Each present has a different weight, and each present has a different star value too: a star for each good deed of the toy's recipient. Santa obviously wants to reward as many good deeds as possible, maximising the total star value of the presents in the sleigh. But he can't exceed the maximal weight or those presents are going nowhere! So which should he put in his sleigh?

The elves start out trying all different combinations of presents to find the best one. This would have been fine if there only were a few items, but they quickly realise it is totally impractical when you have millions of presents to deal with. If they carry on this way Christmas Eve will have long passed and no presents at all will be delivered!

Such a brute force solution is unacceptable, and not only to the elves and Santa. Mathematicians would also find this an unacceptable approach, and ask whether there is an algorithm – a recipe for finding a solution – which works for any number of items, and so that the time it takes to complete the algorithm grows with the number of items in a reasonable, non-explosive fashion.

Mathematicians have a clear definition of "reasonable and non- explosive" in this context: the time it takes to complete the algorithm should grow with the number N of items no faster than the polynomial N to the power of K, for some integer K, grows with N. That's still pretty rapid growth, especially if K is large, but at least it's not exponential.

So does such a polynomial time algorithm exist for our problem? The answer is that nobody knows - not yet - though most mathematicians believe that there isn't. In fact, if you can prove or disprove that a polynomial time algorithm exists you will have answered the question behind door #22 too, as they both can be turned into NP complete problems.

Optimisation problems such as this one, which is known as the knapsack problem, crop up in real life all the time. Thankfully Santa is well read in mathematical literature and knows an algorithm they can use that won't take too long and, while it not give the very best combination of starred pressies, it will get sufficiently close.

So rest assured, if you've been really, really good, your present is probably now packed on the sleigh, ready for the Santa's big delivery run. Merry Christmas!

You can find out more about NP complete problems on Plus.

Back to the Plus Advent Calendar

December 23, 2013
Prisoner's dilemma

When Kepler was decorating his Christmas tree you can be sure his Christmas baubles weren't boring and round. Oh no, we're sure they would have been beautiful and elliptical!

Ah, the humble ellipse. It might look just like a squashed circle but it is so much more! One of the conic sections discovered by the ancient Greeks, it generalises the circle using eccentricity, a measure of how squashed it is. A circle is an ellipse with eccentricity zero, a very squashed nearly flat ellipse will have eccentricity close to one. An ellipse has two foci (points that lie within the ellipse), with the handy property that the sum of the distances from each focus to a point on the ellipse is equal to the ellipse's width. But not just a pretty shape, it turned out to be Kepler's answer to life, the universe and everything - he discovered that the heavenly bodies didn't move in circles, as had been thought for hundreds of years, but instead had elliptical orbits around the sun. Kepler tried to convince himself of the perfection of this design of the heavens by describing the interaction of nature with the heavens introducing a distortion to pull the motion from a perfect circle into an ellipse.

You can read more about conic sections and Kepler's proof on Plus.

Return to the Plus Advent Calendar

December 22, 2013

It's that time of the year again when Santa needs to think about how to deliver all those presents to the people on Earth. Unfortunately his reindeers are a bit weak this year, having suffered some severe bouts of flu, and he knows he can't ask them to travel more than a million kilometres in total. Is there a route around the Earth that visits all those cities, towns and villages he needs to visit, but is less than a million kilometres long?

Limits

A bit tired this year.

That, it turns out, is a very tricky question. One way of answering it would be to try out all different routes and work out their lengths. But since there are 7 billion people on Earth and he needs to visit every single dwelling that's totally unfeasible. It would take him until long after the Universe has ended to try all possible routes. Is there a clever algorithm Santa could use instead?

Obviously, the time it will take any algorithm to answer the question will depend on the number of places that need visiting — the more places, the longer it takes. So the question is whether there's an algorithm for which the time taken grows in a manageable, non-explosive way as the number of places grows — it's what complexity theorists call a polynomial time algorithm. If Santa were to ask such a complexity theorist he would find out that the class of all problems that can be solved in polynomial time has a name: it's called P.

Now Santa doesn't know if his problem of finding a route belongs to the class P. What's pretty obvious, though, is that if someone gave him a potential solution — a route they claim visits every place but is less than a million kilometres long — it would be easy to check whether that's true: he'd simply have to add up all the individual distances between places. A computer could do that quite easily. This means that Santa's problem belongs to a class of problems called NP. It consists of those problems for which potential answers can be checked in polynomial time, even though we might not know how to solve them from scratch in polynomial time.

But now suppose that Santa has a brainwave. Sitting down with a computer he constructs a polynomial time algorithm that finds the kind of route he is after. He would then have shown that his problem is not only a member of the NP class, but also of the P class. Amazingly, it would also hand Santa a polynomial time algorithm for all other problems in the NP class — because it turns out that his problem is a version of the famous travelling salesman problem, and that all the other problems in the NP class can be reduced to it. What is more, his algorithm would win Santa $1 million: the question of whether the P class and the NP class of problems are equal is considered one of the hardest in mathematics, which is why the Clay Mathematics Institute as offered $1 million to anyone who solves it.

Unfortunately Santa doesn't have the time to do any of this, and he's not a computer expert anyway. So he just takes an educated guess at what route to take and gets going, hoping for the best. It's a shame really because if he'd been able to show that P=NP he would have held the key to many of the world's secret communications, including everyone's bank details that are sent encrypted over the internet. This is because NP problems are used as the key for such encryptions, with the secrecy relying on the fact that the problems are very hard to crack. You can find out more in the Plus articles The travelling salesman and Safety in numbers.

Return to the Plus Advent Calendar

December 21, 2013

Raging rivers and thundering waves are exciting and frightening and for mathematicians they are a massive problem. Suppose you've got a turbulent mountain stream — if you're a mathematician, you'll want to know if you can describe the flow of the water using a mathematical equation. Given a point in space (that is somewhere in the stream) and a point in time (say 5 minutes from now), you would like to know the velocity and maybe also the pressure of the water at that point in time and space.

Waves

Image: misty.

Scientists believe that turbulence is described to a reasonable level of accuracy by a very famous set of equations, known as the Navier-Stokes equations. These are partial differential equations which relate changes in velocity, changes in pressure and the viscosity of the liquid. To find the velocity and pressure of your liquid, you have to solve them.

But that's no easy feat. Exact solutions to the equations — solutions that can be written down as mathematical formulae — exist only for simplified problems that are of little or no physical interest. For most practical purposes, approximate solutions are found through computer simulations — essentially through educated guess-work — that require immense computing power.

Plus there is an additional problem that makes numerical difficulties pale into insignificance: no one knows if exact mathematical solutions even exist in all cases. And if they do exist, we still don't know if they involve oddities, such as discontinuities or infinities, that don't square with our intuition of how a liquid should behave.

It's these difficulties that have turned the understanding of the Navier-Stokes equations into one of the seven Millennium Problems posed by the Clay Mathematics Institute. Whoever proves or disproves the existence of finite and smooth solutions is set to earn a million dollars.

All this might seem strange, even scary, given that the equations are used all over the place, all the time — meteorology and aircraft design are just two examples. The fact is that, in the cases we can compute, approximate solutions do seem to give an accurate description of the motion of fluids. What we don't know is what, if anything, the model given by the Navier-Stokes equations tells us about the exact nature of fluid flow.

You can find out more about turbulence on Plus:

Return to the Plus Advent Calendar

Syndicate content