Friday 24 August 2012

Ep 146: Time Travel and Movies Part 1

We still exist!

This week we're inhabiting the nexus of science, pop culture and science fiction. The topic of discussion is Time Travel and how it is portrayed in the movies. There's a little bit of philosophy, a little bit of physics, a dash of the paranormal, and a lot of Dr Boob, who is once again the driving force of this podcast!

If you are interested in Andrew Basiago and Project Pegasus, which is mentioned in this show, you can find more here. If you want to organise your own time traveller convention, or if you can think of a good experiment that BOOB could stand for, let us know.

This is part one of a two part series on time travel and the movies - part two will be out shortly. Tune in to this episode here.

Sunday 29 July 2012

My Olympic Predictions

Over at Plus Magazine, I came up with a predicted medal tally for the London 2012 Olympics. Check out my Mapping the medals article if you are interested in the maths behind it.

My top 20 predicted countries (ordered by total number of medals) are:

2012 Predicted Position2012 Predicted Medals
United States1112
Great Britain279
Russia377
China476
Australia553
France642
Germany642
South Korea832
Ukraine929
Italy1028
Japan1125
Cuba1225
Belarus1321
Canada1419
Spain1419
Netherlands1617
Brazil1716
Kenya1815
Kazakhstan1815
Jamaica2012

And check out my interactive world map, where my predicted top 20 countries are coloured. If you click on each country, you will see results from previous games, a (semi-regularly) updated 2012 medal count, and some occasional comments.

Wednesday 25 July 2012

Broadcasting on ABC Riverina

I have recently been doing a science segment with Chris Coleman on the morning show of ABC Riverina. If you are interested in listening to what we had to say, check out the following links:
We also done a couple of Olympics shows, which will be online soon. Listen in at about 9.45 am each Monday.

Saturday 21 July 2012

Visualising Runs

Inspired by a recent post from Kasey Clark in which he plotted all his runkeeper runs (tracked via GPS) on a single map, I thought I'd explore my own running from the last few years and see how it might be visualised in an interesting manner.

Using his method, I exported all my runs as one big zip file of gpx files (found under your profile) then imported them all into Google Earth. Here is an image of all my runs around Sydney's inner west over the last few years. Most of the time I run along the Cooks River.



I also had a bit more fun with it, and for this you will need the Google Earth plugin for your browser - if you can see the following images you already have it, and if not then there should be a link for you to get it.

The city2surf is one of the world's biggest fun runs and I have done it the last few years. By creating a Google Earth tour, you can create an animation of your runs. I tweeked the gpx code in a text editor (and Excel) to make my 2010 and 2011 runs start at the same time, and then by using the tour gadget, you can embed the animation on your website. Perhaps over time I will add further year's runs to this animation. You'll need somewhere to host the exported kml files from Google Earth. There is a small lag at the start of the video and if it doesn't work, see the video on youtube. I'm looking to knock off that 2011 time this year in a few weeks! Edit 1: I have added a friend from 2010 and 2011.
The next tour doesn't look so great but it would look great in San Francisco or New York City. Google Earth has 3D buildings built in, and by turning these on, you can visualise your runs in 3D. The following shows my Bridge Runs across the Sydney Harbour Bridge and finishing at the Opera House. Runkeeper doesn't quite get the elevation of the bridge correct so it looks like I'm running across water. As mentioned, in cities where there are lots of rendered 3D buildings, this would look great. I haven't bothered yet to tweek the start times for each of the races to all be exactly the same as it's a bit fiddly, but you get the point. Again there is a small lag and if it doesn't work, see the video on youtube.
If you can't see the above videos, and the Google gadget seems really buggy, I have uploaded them to youtube and there you can see city2surf and bridge runs videos.

Tuesday 17 July 2012

Swimming - technique, drag and strength

 
The 2012 Olympics are now only days away. I put together this article for Plus Magazine - check out the original article on Plus for full coverage, and follow Plus closely during the Olympics as they will be running regular sporting articles - see their package on maths and sport.

The men's and women's 100 metre freestyle swimming races are set to be two of the most glamorous events of the London 2012 Olympic Games. Much has been made of the swimming events for London 2012 because the previous 2008 Beijing Olympics saw an unprecedented number of new world records, due to the use of controversial swimsuits. Sixty-six Olympic records were broken during the 2008 Games – indeed, in some races the first five finishers beat the old Olympic mark – and 70 world swimming records were broken in total throughout the year 2008.

The controversial swimsuits have now been banned, but the records they set have not been revoked, so the 2012 Olympics are unlikely to see many new records. This does not mean, however, that the events will be any less competitive, and indeed if records are broken, the performances will likely be exceptional.

Pumping iron or beating drag?


Broadly speaking, records in all sports are determined by two factors: the physical and mental performance of the athlete and technological influence. Pure physical performance tends to improve over time as our understanding of the scientific aspects of sport lead to improved training techniques, diets and race tactics. Technological factors, such as a more supportive shoe, aerodynamic bike or faster car can also lead to quicker times. Some sports such as Formula One car racing have an obvious reliance on technology – notwithstanding the incredible physical and mental toughness required to withstand the cockpit of the F1 car. Other sports such as long distance running may have very little to do with technology, with famous examples of Kenyan runners winning major world events bare foot.

Although at first impression swimming seems to rely little on technology, there are many factors outside a swimmer's control that influence their final time. The type of pool has a considerable influence — the first four Olympics Games were not held in pools, but in open water (1896 in the Mediterranean Sea, 1900 in the Seine River, 1904 in an artificial lake). The 1908 Games were held in a 100 metre pool, whilst the 1912 Games were held in Stockholm harbour. The 1924 Olympics were the first to use a 50 metre pool with marked lanes, and the 1936 Games saw the introduction of diving blocks. Before the 1940s male swimmers wore full body suits that were heavy and caused a lot of drag. Pool designs have also changed with pool and lane width modified to eliminate currents, and energy absorbing lane barriers used to stop waves from adjacent lanes. (See below for a chart of world records over the 100 metre freestyle event since 1904.)

There are, broadly speaking, two things you can do to reduce your swimming time:
  1. Increase your power
  2. Reduce your drag
The magnitude $F_ D$ of the drag force acting on a swimmer moving in a fluid is given by the following equation

\[ F_ D=\frac{1}{2}\rho v^2 C_ D A, \]
where
  • $\rho $ is the mass density of the fluid
  • $v$ is the speed of the swimmer relative to the fluid
  • $A$ is the swimmer's cross-sectional area, that is the area of your body as it is pushing through the water head on
  • $C_ D$ is the drag-coefficient, a number which depends on factors such as the exact shape of the swimmer and the hydrodynamic qualities of their skin and what they are wearing.
Although it may seem like going to the gym and pumping some iron might be the obvious thing to do, reducing your drag is actually a speedier route to a quick lap time. Your power $P$ is the rate at which your body uses its energy, and when you are swimming the power you exert is proportional to the cube of your speed $v$

\[ P=F_ D v = \frac{1}{2}\rho C_ D A v^3. \]

Now suppose you want to increase your speed by 10%, from $v$ to $v+0.1v$. To do this solely by increasing your power, you need to exert a new power $P_1$
\[ P_1 = \frac{1}{2}\rho C_ D A (v+0.1v)^3. \]

The percentage increase in the power required is given by

\[ Increase = 100 \times \frac{P_1-P}{P}= 100 \times (\frac{P_1}{P}-1). \]

Since
\[ \frac{P_1}{P} = \frac{\frac{1}{2}\rho C_ D A (v+0.1v)^3}{\frac{1}{2}\rho C_ D A v^3}=(1.1)^3=1.331 \]

we have

\[  Increase =100 \times (1.331-1)\% =33.1\% . \]

So to increase your speed by 10% solely by increasing your power, you need to increase the power by 33.1%.

Reducing your drag is easier. From the equation for power above we see that the drag coefficient $C_ D$ is

\[ C_ D=\frac{2P}{\rho A v^3}. \]

Keeping your power output and cross-sectional area the same, increasing your speed by 10% requires a new drag coefficient $C_{D1}$ of

\[ C_{D1}=\frac{2P}{\rho A (v+0.1v)^3}. \]

The percentage decrease in drag coefficient is given by
\[ Decrease = 100 \times \frac{C_ D-C_{D1}}{C_ D}=100 \times (1-\frac{C_{D1}}{C_ D}) = 100 \times (1-\frac{1}{1.1^3})= 25\% . \]

So the 10% increase in speed requires a 25% reduction in the drag coefficient.

The exact same working can be used for cross-sectional area — a reduction of 25% will increase your speed by 10%. This is actually the key to the simplest method of reducing drag for most swimmers: improving your technique. Because human lungs are full of air, when we swim our upper body tends to rise and our lower body sinks, increasing cross-sectional area A. The drag force increases and you slow down. Keeping your feet nearer the surface is the easiest method of reducing drag for everyday swimmers.

Drugless doping


At the top end of competitive swimming nearly all swimmers already have very good techniques, so swimsuit technology comes into play. Materials have been developed that increase the swimmer's buoyancy, making it easier to keep their feet near the surface, and reduce the drag coefficient as the material glides through the water more easily than human skin does.

Full-length high-tech swimsuits were first introduced in 1999 before the 2000 Sydney Olympics, with the Speedo Fastskin suits containing V-shaped ridges, modelled on shark skin, to reduce drag. By 2008, the Speedo LZR Racer swimsuit was the most advanced. It was put through wind tunnel tests by NASA and mathematicians modelled water flow around it using a technique called computational fluid dynamics, which simulates how fluid flows around objects (see this article for more on modelling fluid flow). And this research all happened before real swimmers tested the suits in real pools. In Beijing, 89% of all swimming medals were won by swimmers wearing LZR Racer suits.
One of the ways the LZR Racer suits reduce drag is by having panels of a plastic called polyurethane on parts of the body that produce the highest drag. Other swimsuit manufacturers took note. Instead of being textile based with only patches of polyurethane, suits like the subsequent Arena X-Glide were made entirely of polyurethane. These suits were completely impermeable to water, so swimmers could conceivably complete their race without getting wet between their ankles and neck! Records continued to tumble. See more on the Speedo swimsuit technology in this article.

The governing body for swimming, FINA (Fédération Internationale de Natation – International Swimming Federation), took note of the plummeting records and the accusations of "technological doping". In March 2009 it put limits on the suits' thickness and buoyancy, affirming that "FINA wishes to recall the main and core principle that swimming is a sport essentially based on the physical performance of the athlete." They also stipulated that the suits should not cover the neck, shoulders and ankles.

This edict did not actually ban any of the new suits at the 2009 World Aquatics Championships (the "plastic games") — 38 meet records were broken. Subsequently all body-length swimsuits were banned. It was ruled that men's swimsuits may only cover the area from the waist to the knee, and women's from the shoulder to the knee. FINA also ruled that the fabric used must be a textile and not polyurethane. Despite these new rules, the records set by the now banned swimsuits were not revoked and still stand.

And as the term "textile" is not defined, and as scientists are pretty clever folk, the ambiguity of the new rules leaves open a large area for swimsuit development.

Record history


The progression of world records over the 100 metre freestyle event is shown below. Apart from some of the pool changes mentioned earlier, records have continued to drop as we increase our understanding of our physical abilities. Other innovations which have helped reduce times include the introduction of diving blocks in 1936 – previously swimmers had just dived from the wall – and the development of the tumble turn in the 1950s.

Records

It is interesting to note that freestyle as we know it now has not always existed. By definition, in freestyle races you can pretty much swim however you like (with some exceptions), unlike breaststroke, butterfly or backstroke which have defined methods of swimming. During the 1840s, even though they were beaten by native North Americans swimming with a front crawl style, British gentleman swimmers (in an oh so British fashion) swam only breaststroke, considering the front crawl too splashy, barbaric and un-European. In the late 1800s, the quickest (British) freestyle was the Trudgen style, named after John Arthur Trudgen, whose stroke was a combination of side stroke and front crawl. The Australian Dick Cavill modified this style to something similar to what is seen today with his Australian crawl and set a new world record for 100 yards in 1902.

The figure below shows a close-up of times from the early 1980s. You can see the decline around 1999 when the first fast-suits came in, then the sharp decline in 2008. It is difficult to predict when the next dots on the curves will occur.

Zoom on times from 1980s

At the time of writing, Australians are the favourites for both the men's and women's 100 metre freestyle events, with James Magnussen and Matt Targett having recorded the quickest men's 100 metre times in 2012, and Melanie Schlanger the quickest women's time. The UK's Francesca Halsall is 5th so far this year in the women's event, however Simon Burnett in 39th would be doing well to make it past the heats in the men's.

Sunday 6 May 2012

Travelling Salesman - the Movie

Science in the movies is a topic we've looked at a few times here on the blog. But this one is for the pure mathematicians. Check out this preview to the upcoming flick "Travelling Salesman".



I love these kinds of films - overly melodramatic acting, a slight misrepresentation of the science behind the plot (which is OK by me as this is a movie), government conspiracies, and mysterious music. The name "Travelling Salesman" comes from the famous mathematical Travelling Salesman Problem in which a salesman needs to visit a numerous destinations and wishes to do it in the shortest time. Whilst this may seem to be a simple problem, it is one of the most studied problems in mathematics. The more destinations involved, the more difficult to solve and in general there is no algorithm that can find the best answer. Brute force methods (that is, computing every possible solution and then finding the best) are computationally difficult, and with too many destinations, impossible. Hence mathematicians often use heuristics which find good, although not necessarily optimal, solutions quickly.

The premise of the movie is that the famous P vs NP problem has been solved. I'm not a pure mathematician, so I'll do my best here... P problems are those whose solutions can be found quickly (in Polynomial time, hence the P). NP problems are those whose solutions can not be found quickly, but if somehow a solution is produced using some extra information, it is easy to check that this solution is the best one (in polynomial time). Solving these problems take Non-deterministic Polynomial time - hence NP. A good example to show this is a jigsaw puzzle - finding a solution may be very difficult (and it's probably most accurate to image a blind person doing the puzzle), but it only takes a quick glance to see if any solution is correct.

The question that mathematicians ask is whether P=NP - which means, are there algorithms out there that solve seemingly NP problems in polynomial time? We haven't found any yet and mathematicians tend to think that P does not equal NP, but there is currently no proof. Proving this one way or the other is one of the seven Millennium Prize Problems selected by the Clay Mathematics Institute and carries a US$ 1,000,000 prize for the first correct solution.

But why do we care? One of the reasons is that modern cryptography is based on the fact that P does not equal NP - this is the premise of the movie. Modern codes start with a pair of large prime numbers p1 and p2 and multiply them together to give  m=p1p2. The number m is released to the public, but p1 and p2 are kept secret. To crack the code you have to find p1 and p2, given the value of m. It turns out that finding the prime factors of large numbers (100+ digits) is exceptionally difficult, although checking an answer is very easy. It is thought to be an NP problem. But if indeed P does equal NP, this suggests that out there somewhere is an algorithm that could solve this problem in quick time, meaning that modern encryption codes are vulnerable.

They don't give too much away in the preview, but I suspect what happens is they prove P=NP, although the example of looking for something hidden in the desert seems like a P problem (you just check out under each grain of sand, which would be easy, although it's a nice illustration of the problem). We stretch the science here a bit - even if you prove P=NP, you still need to find the appropriate algorithm for the problem, which has never been done. But hey, it's a movie, and we don't pull Terminator up on its stretching of science!

There is a very good write up of the P vs NP problem over on Plus - check it out, it does a much more thorough job than I do!

Saturday 5 May 2012

Ep 145: Teleportation


Is teleportation possible in the real world, or only in the world of science fiction?

In this very special episode, Dr Boob takes the reigns and leads us on a journey through teleportation, whether or not physics allows it and even if it does, can we technologically achieve it? What are the implications if we recreate someone in another spot - what about their soul? Does such a thing exist? And even if you can technologically achieve this, is it possible to reanimate a copy of someone? What do you do with their original version, if you have simply copied them? This could be considered cloning, which brings in ethical questions.

Perhaps wormholes could be a solution to this problem, but we haven't found any yet - however they are, as physicists like to say, theoretically possible.

Tune in to this very entertaining episode (and I can say this without any false modesty as Dr Boob did it all himself) here.


If you'd like to hear more of Dr Boob on this podcast, check out our past joint episodes, mostly on the science of superheroes. He's also on twitter, so come and follow him, he needs friends!


Thursday 26 April 2012

Ep 144: Two-up - an ANZAC Tradition

2012 update: I had a chat to Chris Coleman of ABC Riverina about the maths behind two-up. Check it out here and read on for the 2009 article on the maths.

It's an Australian tradition on ANZAC Day to take yourself down to your local pub and play Two-up - an Aussie gambling game in which you toss two coins in the air and bet on the outcome.

I'm somewhat embarrassed to say that even though I am only a month away from turning 30, this year was the first time I've ever actually gambled on two-up.

It's not a game that is played very often, despite being iconically Australian - according to the GAMBLING (TWO-UP) ACT 1998, outside of casinos it is only legal to play two-up on commemorative days like ANZAC Day (unless you're in Broken Hill, where the local council can legally arrange a two-up game any day of the year).

The rules of two-up are pretty simple. The Spinner places two coins (traditionally pennies) on a small piece of wood (the kip) and tosses the coins into the air. In the version of two-up we played at the pub, the gambling was very simple. Players standing around the Spinner either gambled on HEADS - which is where both coins come up heads - or TAILS - which is where both coins come up tails. If a head and a tail come up, the coins are tossed again and no one wins or loses. To bet, you find someone else willing to gamble the same amount but opposite to you, and then you have a one-on-one contest. If you want to bet $10 on HEADS, then you find someone willing to bet $10 on TAILS, and if you win you get their $10 - if you lose, you hand over $10. It's very simple and I love its inbuilt honour system.

The probabilities involved are simple too - you have a 50% chance of winning each time you bet. At the start of our ANZAC day down in Balmain, most people were betting $5. By the end of the day, as more beers were consumed, many were betting $50 and $100. Gambler's Ruin also started to show it's head - many people think that by doubling your bet after you lose you can get yourself back into the game. This doesn't work in this form of two-up for a couple of reasons. The first is that you need to find someone willing to bet the same amount as you, which is increasingly unlikely the larger you want to bet. And secondly, unless you have unlimited funds (or strictly speaking, more than everyone else you could bet against - or the casino if you are gambling there), it is highly unlikely that you could continually bet without going out backwards.

Two-up is also played in casinos and other gambling houses, and not just on ANZAC day. The rules, as you would expect from such institutions, are not so simple. In this expanded form of the game, there are a number of ways to bet. The South Australian Government has a good guide to two-up play, but simply put:

Players can bet in the following ways:

1) HEADS - odds of 1/1 ($1 bet pays $2, including your original $1);
2) TAILS - odds of 1/1;
3) 5 consecutive ODDS - odds of 25/1 ($1 bet pays $26).

The Spinner can bet in the following ways:

1) 3 HEADS are thrown before TAILS is thrown and before 5 consecutive ODDS are thrown - odds of 7.5/1 ($1 bet pays $8.50);
2) 3 TAILS are thrown before HEADS is thrown and before 5 consecutive ODDS are thrown - odds of 7.5/1.

This makes the game a little bit more interesting. The Wizard of Odds website for two-up sets out the probabilities for each of these outcomes - let's derive where they come from. At each toss of the kip, for this analysis it is best to think of there being 3 possible outcomes - HEADS, TAILS or 5 consecutive ODDS. We think of it this way because if a single ODDS is thrown, it is re-thrown and only makes a difference if it is one of five in a row.

Player Odds:

As you can see, the House is paying out as if the odds are better than they actually are. It's not much, but this is how they make their money.

Spinner Odds:

Again we can see, the House is not paying enough for a win - the odds should be 7.8 to 1, rather than 7.5 to 1. However, were you to back HEADS on each throw rather than as the group of three, the house would offer you odds of 7 to 1 (this is left as an exercise for the reader...), so the spinner's bet is better.

As it turns out, I came out even at the end of the day! There's some more maths to be had here - sometime soon we might take a look at some of these pay-out distributions.

Sunday 12 February 2012

The Big Swim

Recently I competed in one of Australia's biggest ocean swims, The Big Swim. Now I'm not particularly good, just stupid and competitive, and the results provide a nice sporting dataset with which to play. I've wanted to teach myself some mapping / visualisation techniques for a while, so I took the opportunity to investigate this data in order to find out from where competitors for the event came, and from where they are the quickest.

I have created the following interactive chart using Google Fusion Tables. From the swim results, I extracted the competitors' times and the suburbs they came from, and then mapped the suburbs to their postcode using the aus-emaps postcode finder. From this table I worked out the average, minimum, maximum and median times for each postcode. I've only plotted New South Wales postcodes.

The tricky part was mapping the postcode boundaries. Thankfully, the Australian Bureau of Statistics has a couple of files you can use, however to use these with Google Maps, you need to convert them to the kml file type. MyGeodata Converter provide such a service. This meant we had two files - one with the swimmer statistics per postcode, and one with the boundary coordinates. It is easy to merge these tables with Google Data Fusion, and voila, you have an intensity map.

The map below is coloured by the number of competitors from each postcode - red is the most and green the least. The most swimmers came from postcode 2026, which is Bondi and surrounds. Many postcodes, including my own, only had one competitor. If you click on a postcode, it will give you that postcode's statistics - note that the times are in decimal (Google Data Fusion has some issues with data type, so it was easiest to treat the times as decimals, rather than date/time format). So 51.58 minutes means 51 minutes 35 seconds.

The quickest postcode (that had over 10 competitors) was 2075 (St. Ives and surrounds). The slowest with over 10 competitors was 2153 (Baulkham Hills and surrounds). One might postulate that Baulkham Hills is too far from the beach, and that everyone in St. Ives has a private swimming coach. Or it could just be random, as there really aren't enough swimmers per postcode to draw too many conclusions.

The biggest bug in this is the "Sydney" postcode which is, I'm fairly sure, way over populated due to people putting "Sydney" down instead of their suburb in their swim registration. Not that many people live in the city.



The following chart shows the distribution of times, which looks quite like a normal distribution with a slight right skew due to the fact that there is a hard limit on the quickest you can possibly complete the swim, whilst you can take as long as you like to finish. Large public sporting events tend to have a long tail as people may come out once a year and jump in the ocean without particularly caring how quickly they go. This is especially true for running events where you often have people dressed up as Snoopy out the back. Ocean swim events tend to have less of this as, unlike running, if you stop, you drown! So without a very long tail, the Central Limit Theorem kicks in and gives you a normal-ish (or log-normal distribution) distribution.


References:
  1. The results come from the Ocean Swims website (which is an excellent source of information for ocean swimming in Australia) - the Ocean Swim Series website is also a good data source.
  2. Make your own tables and maps at Google Fusion Tables.
  3. The postcode information came from the Australian Bureau of Statistics and aus-emaps.
  4. I converted the ABS data to a kml file using MyGeodata Converter.
  5. All Things Spatial is a great resource for data mapping