Header tag

Thursday, 28 April 2011

Isaac Newton's Random Walk

Poor Isaac Newton.  He was having a pleasant afternoon nap, but was disturbed by a gravity-driven apple.  His attempts at destroying the apple that fell on his head have almost led to the death of a poor innocent bystander, and he's had to explain his actions to the local constabulary.  After a long and gruelling day, he's visited the local pub, and drunk slightly too much cider (stupid apples).  Now, having stepped out of the pub, he has to get to his house at the end of the street.  Alternatively, he could go to his aunt's house, at the other end of the street.

Conveniently, the pub is located at the middle of the street, which is 20 metres long.  His house is at one end, his aunt's house is at the other end.  Both possible destinations are 10 metres away.  In his slightly tipsy state of mind, the best that Mr Newton can manage is a stride of 1 metre; however, he's so unbalanced (he's also developing an apple-shaped bruise on his head) that it's not guaranteed that he'll keep going in the same direction.  In fact, it's 50/50 each time on which way he'll go.

How many steps will it take him to get home?  And at the rate of one step every 10 seconds, how much time will it take?



There are two ways of solving this one: the pure maths way, or the spreadsheet way (actually do some experiments on a spreadsheet).  Let's do the spreadsheet way first.



Each step is 1 metre long, but can be +1 metre or -1 metre, so we need to randomly produce a +1 or a -1 and add it to the previous distance walked.  This is easy enough in a spreadsheet - with a column of random +1 and -1 and a column which sums the previous column.  The function I've used for the random numbers is:

=(2*ROUNDUP(RANDBETWEEN(0,1),0))-1

I then look down the 'total distance covered' column until I find the first +10 or -10.

I've run the test 20 times, and have obtained the following results for the number of steps it takes Mr Newton:

22, 20, 30, 20, 82, 94, 142, 106, 52, 51, 76, 92, 44, 74, 142, 50, 25, 17, 82 and 16.

What is there to say on this?  Isaac only has to travel a net distance of 10 metres in either direction, and yet in some cases it's taken him over 100 steps to cover the distance (he's not just drunk, he's very drunk).  At his best, he's managed it in 16 steps, with most of them in the same direction!

The results here show how probability (chance) is a key part of this question.  We've not given Isaac any sense of direction at all, and he's at the mercy of probability.  As a result, mathematically, all we can aim for is an approximate, or an average distance that Newton can travel.  Unfortunately for him, the mathematical average of his wanderings is going to be close to zero - for every step he takes to the left, he has an equal chance of taking a step to the right.

Doing it the pure maths way involves probability.  There's a 50% chance that Newton will go to the left (let's call this a step of -1) and a 50% chance he'll go to the right (this is a step of +1).  Let's start him at zero, and assume that he has to reach either +10 (his home) or -10 (his aunt's home).

After his first step, he has a 50% chance of moving even closer to his target, and a 50% chance of returning to his starting position.  So the probability of him making two consecutive steps towards either target is (0.5 x 0.5) x 2 since he has two targets to aim for (one at each end of the street), which is 0.5 - in fact, after two steps, Isaac has either moved two steps towards one target (+1, +1 = +2 or -1, -1 = -2) or moved back to his start position (+1, -1  =0 or -1, +1 = 0).


However, the maths becomes considerably more complex after three steps, and more complicated still if we need Isaac to achieve ten steps in one direction or the other.  I won't do the maths here, but after a large number of steps, it becomes clear that the most probable location after a large number of steps is close to the start point, as mentioned above.  On average, the number of steps in one direction will be balanced by an equal or similar number of steps in the other.  This is known among mathematicians as the random walk problem, and Wikipedia has plenty to say on it (no surprises there).

The question becomes not "When will Mr Newton reach his destination?" but "How likely is he to have reached his destination after 10 or 20 or 30 or 40... steps?" and that's far more complicated than I'd like to cover here - it's why I prefer science to maths!

Other articles I've written with spreadsheet solutions include:


What is smog?

Over the last few days, we've seen in the news how some of the cities in Britain (well, we've had pictures of London, and on the television London = Britain) have been covered in smog.  The word "smog" comes from a combination of smoke and fog, but what causes it and where does it come from?

Smog usually comes from sources like car exhaust fumes, and fumes which have reacted in sunlight to produce other pollutants (called 'secondary pollutants').  Worse still, the primary pollutants (directly from car exhaust fumes or from burning coal) can react with the secondary pollutants to produce a real mix of gases, called photochemical smog.  "Photochemical" reactions are ones that use light to make them go - in the case of smog, it's sunlight that drives the reactions.

Photochemical smog is produced by the chemical reaction of sunlight, nitrogen oxides (NOx) and other organic compounds in the atmosphere.  Smog also contains airborne particles (called particulate matter - bits of dust, ash and smoke) and ground-level ozone.  Ozone is best kept in the upper atmosphere; at ground level it's toxic (despite what you might have heard about invigorating ozone at the seaside - that's just misinformed nonsense).

Nitrogen oxides are formed when nitrogen and oxygen in the air react together under high temperature such as in the engines of cars and trucks, coal power plants, and industrial manufacturing factories.  Nitrogen and oxygen make up about 98% of the atmosphere between them, and when these are drawn into a hot internal combustion engine, they react together to product nitrogen oxide (NO) and nitrogen dioxide (NO2).  Both NO and NO2 are harmful to human health.

So, smog contains ozone (toxic) and NOx (harmful), along with dust, smoke and so on.  It builds up when the air is still - very little wind - and can occur at times when there's high air pressure.  London has suffered serious instances of smog in the past, in particular in 1952.  Work has been done to reduce smog in Britain and in Europe, in particular reducing the sulphur content of fuels - burning fuels that contain sulphur leads to the formation of sulphur oxides which contribute to smog - and also, incidentally, to acid rain.  This is why smog is generally rare in London... that, and the fact that we rarely get the still, sunny weather that's needed to produce it!

Friday, 1 April 2011

Moon's Orbital Radius Increasing

In an unexpected and unprecented move, the European Space Agency announced this morning that their data shows that the Moon has started to increase its mean orbital radius at a rate considerably higher than previously believed.  It's been known for some time that the distance from the Earth to the Moon is increasing, but the rate of increase is worrying.  In other words, the Moon is moving further away from the Earth faster than we thought, and in a few year's time will leave the Earth's orbit completely.  

This finding comes after a series of measurements of the Earth-Moon distance (carried out using a more accurate process than this one), using a laser beam pointed at a network of mirrors which Neil Armstrong placed on the Moon's surface over 40 years ago, during the Apollo 11 mission.  By measuring how long it takes for a beam of light to travel to the Moon and back, ESA scientists have been able to determine that the distance from the Earth to the moon has, over the last three years, increased by an average of 140 metres per year.  




However, more alarming is the fact that the rate of increase is also going up - the Moon is, on average, moving further away at a faster rate with time.  The increase over the last six months is about 1.4% more than the average increase over the previous six months.
 



Exact forecasts vary, but ESA scientists are all agreed that within 14 years the Moon's orbit will have extended so far that it will leave the Earth's gravitational field completely, and head off into space.  The team of scientists have proposed various reasons for the Moon's recent moves, and the most common suggestions are related to the recent tectonic activity on Earth - the tsunami of 2004, the volcano in Iceland during 2009-10, and possibly the recent earthquakes near New Zealand, an in particular Japan, which has left to a shortening of the length of the Earth's day.  The recent earthquakes have coincided with the moon coming towards a particularly close approach (perigee) and the theory proposes that this has caused the moon to increase its speed while making this close approach, which will lead to it reaching a larger distance at its furthest point 14 days later.

Other scientists have yet to confirm the team's findings, which have sparked considerable controversy in astronomical circles.  Teams in the southern hemisphere have carried out measurements into the exact time for the moon's orbit and have not noticed a significant change in this - either an increase or a decrease, and therefore have concluded that the moon's orbital radius has not changed.  Other teams are preparing to carry out their own measurements using Armstrong's mirrors, and will be sharing their results later next week.

Tuesday, 29 March 2011

Maths Puzzle 6: Maximum area for a perimeter

Here's a puzzle I devised, pondered and then worked on solving:  imagine you have a piece of string, tied so that it forms a closed loop exactly 12 cm long.  What's the maximum area that could be contained by the string if the shape that was formed was always a right-angled triangle?


Okay, so it's not a difficult question to describe, but taking it apart leads to some interesting questions.  At one extreme, we have a triangle that's almost exactly 6cm tall with almost no width, and at the other extreme, we have a triangle that's almost exactly 6cm wide with no height.  Somewhere in between we have a triangle with maximum area.


The main formulae that we need to use to help us are the area of a triangle, the perimeter of a triangle, and the relationship between the sides of a right-angled triangle.


The area of a triangle is half times the base times the height.  In our case, let's call the base x and the height y.


A = xy / 2


The perimeter of a triangle is the sum of the three sides, x, y and the third side (which will be the side opposite the right angle), the hypotenuse h.


x + y + h = 12


Finally, the relationship between the sides of a right-angled triangle are set by Pythagoras' Theorem, which says that x2 + y2 = h2


I'm sure there's a complicated expression that connects x, y, h, A and the perimeter, but that's not how I solved this problem.  In other words, I solved the problem by testing various values of x, and using a spreadsheet to determine y and h, and therefore A.


The relationship between x (the height) and A (the area) is shown in the graph and table below.




A few points I noticed about my results:

As I had anticipated, the maximum area is obtained by having an isoceles triangle, with two sides of 3.51, which is 12/ (2 + sqrt 2)), and it isn't 3 1/2.

What surprised me, though, is that the graph is not symmetrical.  I suppose, on reflection, there's no way it can be symmetrical:  if having length x at 0 cm leads to zero area, and having length x at 6 cm also leads to zero area, then for the graph to be symmetrical, the area would have to peak at exactly x=3, and this wouldn't be an isoceles triangle.

I also assumed it would be symmetrical because I was too busy looking at the symmetry of x and y.  For each value of x, there's a corresponding value of y, and the two can be swapped around (so that (x,y) is a valid pair, and so is (y,x).  However, the relationship between x and A, the area, is much more complicated, and it is not symmetrical.

This second graph is perhaps a little confusing, but it represents the way that the two sides x and y, and the area A are connected.  The area of the bubbles or circles represents the area of the triangle which is produced when the sides of the triangle are x (along the bottom) and y (up the side).  I've highlighted the maximum area with a lighter blue.

For those who are interested - no, I haven't calculated A in terms of x alone, and I haven't differentiated either. I've just used Excel to 'goal seek' values of y and h for a given value of x, and worked from there! Some things to note: there are better ways of enclosing area other than using a triangle. For example, by using a square with three sides of 3cm each, we could enclose an area of 9 cm2, which is almost 50% more than with the right-angled triangle. The optimum approach would be to have a circle. For a circumference of 12 cm, the radius of the circle would be 1.91 cm (12 divided by 2 pi) and the area would be 11.46 cm2, which is approaching double the area enclosed by the triangle, and 27% more than the square.

Friday, 18 March 2011

What are Constellations?

Astronomy 2:  Constellations

Constellations are man-made dot-to-dot pictures in the night sky, connecting the stars in the sky into pictures of people, animals and other objects.  The stars we see were grouped into constellations by the Greeks, who made up stories about their gods and then used the characters from these stories as the basis for grouping stars together.  For example, a group of stars might look like two people standing side by side, and so they'd be identified as twins.

The stars that we group into constellations are not always close together in space.  Although two stars might look close together, one could be considerably further away than the other, but might seem to be next to each other because we have no sense of perspective in space.  We can't tell if one star is closer to us than another - and brightness is no help either.  A star that looks bright might be close to us, but a star brighter might be an extremely bright star that's actually further away.

Anyway, treating the stars as points on a flat canvas, the ancient Greeks started to group stars together into pictures, characters, animals and so on.  They didn't have to contend with light pollution, and tended to have clearer skies than we do in Britain (I've missed a number of eclipses due to clouds) so they were able to see more stars at night.  This makes it easier to draw their imaginary dot-to-dot pictures in the sky.

The Greeks got to name the constellations that we talk about today, because they were the first to classify them.  However, there's nothing wrong with devising your own constellations, using the stars that you can see at night.  For example, here's a constellation called Ursa Major (Greek for the "Great Bear").  




This part of the constellation is also known as the Plough.  But they could just as easily be called the Saucepan or the Ladle.




The saucepan...




Or the ladle...


A few things to consider when looking for constellations:  they're not always the same way up.  The Earth is rotating all the time, and this means that the stars (and the constellations) rise in the east and set in the west, in the same way as the Sun (and the moon).  The Earth's axis is tilted - what this means is that the Earth doesn't spin with a vertical axis (like spinning a basketball on your finger), but it's tilted so that it spins with a tilt


The effect of this is that the constellations appear to rotate around a point in the sky - in fact, there's a star in the sky which doesn't rotate.  The earth's axis points directly at it, as it's above the North Pole, and the star is called Polaris.  The photo below was taken near the equator, and shows the stars rotating around the pole star (the dot near the centre of the horizon).




So, although pictures in a book or on a website might show an 'upright' version of a constellation, bear in mind that it might not always look like that in the sky.  It might be at a slightly different angle, and parts of it might be obscured by clouds, and may have fainter stars hidden by light pollution.  One very important consideration is the time of the year; some constellations are only visible at certain times of the year.  I'll explain this some time soon, but as an example, Orion is only visible during the autumn and winter months.

And in all honesty, constellation spotting is sometimes an exercise in imagination.  Some constellations look nothing like the objects or characters that they're meant to represent, and require a serious leap of faith to identify.

Saturday, 12 March 2011

Physics: Gravity vs Sound

Isaac Newton, upset with his failed attempt to discard the apple that woke him from his afternoon nap, decided that it was time to take stronger measures to destroy the apple once and for all.  Deciding that he would give the stupid apple a lesson in gravity, he took it to the top of a tall building, and dropped it, so that it would hit the ground at great speed and disintegrate into lots of tiny pieces of apple sauce.

However, to his horror, he realised at the exact moment that he dropped the apple that there was a poor unfortunate man standing directly underneat the apple, and shouted down at the man to move out of the way of the doomed fruit.

But would the man hear Isaac's shout in time?  Or would he suffer the same fate as our unfortunate father of modern physics?

The question is - which will reach the man first:  the apple, accelerating due to gravity, or the sound of Mr Newton's shout, travelling at the constant speed of sound?

Firstly, the apple.  The apple is accelerating at 9.81 ms-2, getting faster all the time.  Yes, I'm ignoring terminal velocity and air resistance for now.

The formula to use for the apple is   s = ut + 1/2 a t2.
s = distance travelled
u = initial velocity = 0
t = time since apple was dropped
a = acceleration due to gravity

since u = 0, (when the apple was dropped it had zero initial speed), we have a simplified formula:  s = 1/2 a t2
This tells us s (how far the apple has fallen) after so much time has passed (t).  We can rearrange it to tell us how long it will take the apple to fall from a building of height s.  This gives us:

√(2s/a) = t


The formula for the sound of Isaac Newton's shout is simpler:
v = s / t

s = distance
v = velocity = the speed of sound, 330 ms-1
t = time since Isaac shouted

Rearranging gives us t = s / v


Now, suppose the building Isaac standing on was 300 m high, just short of the Chrysler Building's 319m.  No, the buildings in Isaac Newton's time weren't this tall, but let's just suppose he had a time machine and he made the journey.


For the apple: √ (2s/a) = t
Time taken is 7.82 seconds

And for the shout,

t = s / v = 300 m / 330 ms-1 = 0.909 seconds


So, the shout will reach the ground (7.82 - 0.909 = 6.91) seconds before the apple does, giving the potential victim time to move out of the way.



From here, we can go on to work out how high a building would have to be for the apple and the sound to reach the ground at the same time. From any height above this, the apple would always land before the shout (because the apple will keep accelerating - we're still ignoring terminal velocity) and no amount of shouting would save a victim from being hit on the head by the apple.


In order to do the calculation, we simply set the time for the apple and the time for the shout to be equal.  This gives us:

t = √(2s/a) = s / v

√(2s/a) = s / v
2s/a = s2 / v2

2 v2 /a = s

We can now put in (substitute) the values for the speed of sound (330 ms-1) and acceleration due to gravity (9.81 ms-2), and calculate the height of the building (s).  


2 x 3302 / 9.81 = 22,201 metres, whiich is very, very high indeed.  To put it another way:

It's just over 73,200 ft, which is 2.5 times higher than Mount Everest.
It's twice the height on airliner's cruising altitude.


Air resistance will be less of a problem to start with, but sound needs air to travel through, and the air is so thin at those heights that the sound won't travel as well or as fast.  I'm not even going to discuss the lack of air pressure; lack of breathable oxygen; the temperature (frozen apples and frostbite); terminal velocity and air resistance.

When, during an A-level class, my maths teacher posed this question, I don't think she was thinking of such things either.  That's the problem with maths without science - it can give you an answer that is meaningless and useless when you actually consider the real world!

Tuesday, 8 March 2011

Maths Puzzle: How far does the fly fly?

Two boys set off on their bikes, at the same time, to meet each other.  They are 24 miles apart, and the road between them is perfectly straight.  The first boy cycles at 6 mph (he's only a very small boy), and the second boy cycles at 4 mph (because he's even smaller, and can't cycle as quickly).  A fly sets off from the first boy's handlebars at the same time as the boy starts cycling.  It flies in a straight line from the first boy's handlebars until it reaches the second boy's handlebars. It then turns around, and flies back to the first boy's bike, then when it reaches the first boy, it turns around again and back to the second boy's bike, and so on until the two boys meet.  The fly travels at 12 mph.

How far does the fly travel in total, from the moment the boys set off, until the moment they meet?  The time taken for the fly to turn around every time it reaches a boy can be ignored.

I like this type of puzzle - I liked it even more when I spotted an easy way of solving it. 

But first, the long way.


The fly sets off at 12 mph, at the same time as the second boy starts cycling towards it, at 4 mph.  There are 24 miles between them at this point, and the two travellers are approaching at 16 mph.  It will therefore take them


time = distance / speed = 24/16 = 1.5 hours


to meet.  This is the longest single part of the fly's journey, as the boys were at their furthest from each other.


However, in that time, the second boy has cycled 1.50 hrs x 4 mph = 6 miles, and the first boy has cycled 1.5hrs x 6 mph = 9 miles.
The fly has travelled 1.5 hours x 12 mph = 18 miles.  This makes sense - the second boy has cycled 6 miles, and the fly has travelled 18 miles, and 6 + 18 = 24 which was the starting distance between them.


Finally, while the fly has been flying the first leg of its journey, the two boys have reduced the distance between them from 40 miles to 24 - (9 + 6 miles) = 9 miles.



Now, the fly turns around, and starts to fly towards the first boy.  The first boy, remember, is cycling at 6 mph; the fly is still going at 12 mph, so their closing speed is 18 mph.  They have to travel 9 miles (the distance now remaining), so this will take:


time = distance / speed = 9 miles / 18 mph = 0.5 hours (which is 30 minutes).


In that time, the first boy travels 0.5 hours x 6 mph = 3 miles.
The second boy travels 0.5 hours x 4 mph = 2 miles.
And the fly travels 0.5 hours x 12 mph = 6 miles.


This makes sense - note that the first boy and the fly have together covered the nine remaining miles between them, 3 + 6 = 9


So far, the fly has travelled a total of 18 miles + 6 miles = 24 miles.


The distance between the two cyclists is now down to
24 - ((9 + 6) + (3 + 2)) = 4 miles


Continuing for a third leg, our tireless fly starts back from the first boy to the second boy.  The second boy is cycling at 4 mph, the fly is travelling at 12 mph.  Closing speed is 16 mph, and distance to cover is just 4 miles.


4 / 16 = 0.25 hours (15 minutes).


First boy covers 0.25 hours x 6 mph = 1.5 miles
Second boy covers 0.25 hours x 4 mph = 1 mile
Fly travels 0.25 hours x 12 mph = 3 miles


Distance remaining is 24 - (( 9 + 6 ) + (3 + 2) + (1.5 + 1)) = 1.5 miles
Fly has now travelled 18 + 6 + 3 = 27 miles


Clearly, this is going to take a long time to solve through this method.

Here's the shorter way.

The boys have to cover 24 miles.  The first boy cycles at 6 mph, and the second boy at 4 mph.  This means that they are approaching each other with a closing speed of 10 mph, and it will take them 24 miles / 10 mph = 2.4 hours (2 hours and 24 minutes) to complete their journey and meet up. Obviously, there are many different versions of this story, involving trains and so on, but the principle is the same (and you can change the numbers to make them more realistic - I think my boys are pedalling at walking speed!).


The fly, meanwhile, is flying at 12 mph.  This means that in the 2.4 hours it takes the boys to meet, it will fly 2.4 hrs x 12 mph = 28.8 miles.


It really is that easy.  No diagrams, no long complicated adding up then adding up some more.  Sometimes, all that's needed to solve a problem is a different perspective!

If you enjoyed this article, you may like some of my other, more recent posts on puzzles and games that can be solved with a calculator:

Snakes and Ladders (Collatz Conjecture)
Crafty Calculator Calculations (numerical anagrams with five digits)
More Multiplications (numerical anagrams, four digits)
Over and Out (reduce large numbers to zero as rapidly as possible)
Calculator Games: Front to Back
Calculator Games: Up, up and away with Ulam sequences
Calculator Games: The Kaprekar Constant