Search:

Tuesday, 12 October 2010

Everybody wave to 2010TD54!


One of the nicest thing about the web is the way that it's still being used for freely shared information, particularly among academic and research groups as it was originally designed for.  NASA are one group that are particularly good at producing some really interesting stuff for everybody, from pretty pictures to proper orbital data.

And just sometimes, that orbital data says something a tad out of the ordinary.  This image was generated by a website belonging to the Jet Propulsion Laboratory, the people who brought you the glorious Cassini-Huygens mission.


The two yellow lines are just there to show where the Sun is, and to give a sense of perspective.  Then you can see the orbit of Mercury looping around it, and Venus, Earth, and the last white line is part of Mars' orbit.

Then there's the blue line.  The dark bit is where it's been, the light blue bit is where it's going.  And yes, it's a bit close to the Earth. 

2010TD54, meet the Earth, and all who sail on her.  Earth, meet 2010TD54, a fairly small asteroid that's about to get a bit intimate.  Feel free to blow a kiss as it whizzes by.

The image, in fact, shows TD54 a bit further out on Oct 11th, the closest approach is around 10:49 GMT (11:49 BST) on Oct 12th.  It's going to be very close in astronomical terms, around about 45,000 km in fact, which is a whisker.  If we ran a rope around the equator twice then it would be long enough to reach.

Don't Panic.  TD54 is only about 6m across.  Its kinetic energy is equivalent to roughly one percent of a megaton of TNT, similar to a very big conventional bomb or a very tiny nuke.  Even if it hit, which it won't, it would be unlikely to do any serious damage; maybe destroy a few houses, but more likely just burn up in the atmosphere.  In fact, it's a significant technical achievement to find and track something that small before it's passed us by.

Saturday, 9 October 2010

The Sun, a drunkard's walk and some Python...

I've been playing around with Python recently - the programming language that is, not the snake.  (Snakes are cool too though.)  One big difference with Python as opposed to PHP and Perl, the languages I normally use, is that Python is a little more geared towards graphical simulations rather than simply playing with a text input/output, especially with the pygame modules installed.  Coming from a physics background, an obvious starting point is to try simulating some simple particles and maybe some gravity.

I had a dig around and found this script by Niels Stender which does exactly that, in a fairly elegant way.  I find that tinkering with somebody else's code is a good way to get to grips with the syntax and style of a language.

Stender's code simply generates the particles and the relevant physics and starts them running, it's a good estimation of how particles behave in a gas, anything from the Earth's atmosphere to the interior of the Sun.  There's a classic fact that gets trotted out in many astrophysics lectures: it takes around a million years for a photon to get from the centre of the Sun to the surface...and photons travel at the speed of light.

Why so long?  Well the photons bounce around a lot, like the particles in this simulation.  The way they bounce around is random, like tossing a coin.  Toss a coin a thousand times and you'll get roughly 500 heads and 500 tails - the equivalent with our photon is that it stays pretty much where it started, at the centre.  The odds of it reaching the surface of the Sun are very small, it would be like tossing a coin a thousand times and getting a thousand heads...which is why it takes so long, the photon has to wait for something very unlikely to happen.  This process is known as a random walk, or slightly more poetically, a drunkard's walk.

Which is where my addition to the code comes in.  I fancied tracking one individual particle, no different to any of the others (except it's red, just to make it more visible) and recording the x coordinate.  Over time my code builds up a graph of the red particles position, which should, if the code and theory are correct, closely resemble a Bell curve, or a normal distribution pattern.  This shape pops up everywhere from population biology to the most fundamental quantum theories, it's a mathematical signature showing that something truly chaotic and random is happening:


Here's some video of my script running....

And now here's the same simulation, ten minutes later.  The graph in the bottom right is a reasonably good fit for the Bell curve, hooray!



You can have a tinker with the code yourself if you want - the source code is here. You'll need to install Python and pygame, both of which are free, if you don't have them already.