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.

Thursday, 30 September 2010

Fermi Problem: The Day The Music Dies

A Fermi Problem, in case you've not heard of one, is a bit of a game really.  It's a riddle in a way, a question that generally asks for a rough estimate to a technically very difficult problem.  You're not expected to be get the right answer, in fact for many problems if you're within a hundred times the right answer then it's pretty good.  Not to be confused with the Fermi Paradox (same Fermi, different quandry) which is related to the existence or otherwise of extra-terrestrial life.

The point is to show your working.  That's the interesting bit, come up with a wild guess, but base it on a few real life factors.

So my problem is this:

Music is finite.  If you're fairly strict about the standard rules of western music and the range of human hearing, then there's only so many combinations of notes.  "All the tunes possible" is a very big, but finite set.

If humans continue writing tunes and expanding at their current rate then when will we have used up all the music?


Obviously, you could just make the tunes longer and longer to get more and more of them, so I'm also going to place a time limit on "All the tunes possible": you've got a maximum tune length of nine minutes forty eight seconds.  If it was good enough for Bat Out Of Hell it's good enough Fermi.

Hit the read more link for my proposed answer...


Wednesday, 29 September 2010

Mice, Chickens, Eggs & Evolution

I'm being out-evolved by something living behind my fridge. We've got a mouse in the flat. It's no big deal, the Old Town of Edinburgh is swarming with the blighters, the place is a six hundred year old labyrinth, bridges have been built over streets, covered up, filled in, tunnelled through, it's a mouse paradise. They're not usually much bother - the bleepy deterrents normally do the job, and on the rare occasions when they get a bit overly courageous we put down poison. No, it's not the kindest method, but it is one of the few that works on Old Town mice, and kinder than those sticky traps.

The mice, however, seem to have got wise to it, the poison doesn't work anymore. Actually, that's not technically accurate. I'm sure the poison still works, the mice just aren't falling for it any more. Not because they know it's poison of course, they don't, the absence of very small toxicology textbooks is all the proof I need of that. They're just not touching the stuff any more. What must have happened is that sometime in the last couple of years there was a community of mice. Most of them liked blue coloured grain, they took it and ate it and died hopefully peaceful deaths from hypothermia. A couple of them didn't. For some reason or another they didn't go for the free food. Maybe it was the smell, maybe the colour, maybe they just didn't like the taste - maybe they're refined mice and expect more presentation than a small plastic tray. For whatever reason, they didn't eat it. So most of the mice died...but a few survived to have baby mice. The baby mice inherited their parents' dislike of the grain we put down, so they don't touch it either, and they have more babies, none of who are partial to warfarin laced wheat.

Nothing has changed except the fact that the humans are a weapon down in the ongoing struggle for Old Town domination. The drugs don't work.

So if anyone doubts evolution, I've got some mice you should meet.



Speaking of evolution, which came first, the chicken or the egg? It's a bloody stupid question. Ever since I was a kid I've hated this one. The fact of the matter is, the egg came first, end of story, argument over, you're very welcome.

Firstly, let's go a little further back. There weren't always chickens. There were dinosaurs, and then there was Archaeopteryx, then there were the proto-chickens. Humans began to domesticate these birds and slowly they crept their way towards full-blown chickenhood. Of course, what constitutes full-blown chickenhood is still up for debate - there's maybe one specific genetic tweak that produces some morphological change that defines a chicken, but the point remains: however you define a chicken, there was a first one.

The first chicken hatched from an egg that was laid by an animal that wasn't a chicken. It was very nearly a chicken, in fact you'd probably need to run a battery of tests to confirm that it wasn't a chicken. This nearly-chicken laid an egg. As is the way with the world, the reproduction from adults to offspring wasn't perfect, there were small glitches in the DNA. Most of them did very little indeed, but in this case there was one tiny error in the strand that made the offspring a little different to anything that went before. It was a chicken, the first in a long, noble and tasty line.

And if the animal that comes out of an egg is a chicken then that egg is a chicken egg by definition. The egg belongs to the animal inside it, and that animal was a chicken.

The egg came first, but it wasn't laid by a chicken. End of discussion, game over, QED.

Sunday, 26 September 2010

Total Eclipse Pt II: The Explanation

So what on earth was the last post all about?  Well, you know how it is.  It's Saturday night, you've had some wine and cheese and pate and olives and suddenly you start having "good" ideas.  Yup, sorry, I was drink-coding.  These things happen.

Whilst researching for an 80's themed fancy dress party I came across a stunning piece of work by Jeannie Harrell, a flow chart that generates a section of Jim Steinman & Bonnie Tyler's cult hit "Total Eclipse Of The Heart".

As this gloriously demonstrates, most songs have a structure, bits repeat.  Total Eclipse does this repeatedly, and as such is ideal for a really silly coding exercise, which (if you're not familiar with PHP) is what all that gibberish does.  It generates the entire song using a mere 2366 characters, rather than the 3050 in the official version from Bonnie Tyler's website (not including whitespace).  That's a 22.4% saving on keyboard wear and tear if you ever need to type the lyrics out on a website.

Bat Out Of Hell should also work quite well...in fact, I'm tempted to compile a league table of songs and how compressible they are....2 Unlimited may well end up near the top...





"Total Eclipse Of The Heart" (Optimised Version)

<?php
// TOTAL ECLIPSE OF THE HEART by Steinman & Tyler //
// (Optimised cover version by McGhee & Robbins) //

$short_turn="Turnaround, Every now and then I get a little bit ";
$rabbits="Turnaround bright eyes";
$longturn="$rabbits, Every now and then I fall apart";
$need="And I need you";
$forever="Forever's gonna start tonight<br>";
$time="Once upon a time";
$eclipse="A total eclipse of the heart<br>";

$v1=array("lonely and you're never coming round<br>",
          "tired of listening to the sound of my tears<br>",
          "nervous that the best of all the years have gone by<br>",
          "terrified and then I see the look in your eyes<br>");

for ($i=0;$i<4;$i++){echo $short_turn.$v1[$i];}
echo "$longturn<br>$longturn<br><br>";

$v2=array("restless and I dream of something wild<br>",
          "helpless and I'm lying like a child in your arms<br>",
          "angry and I know I've got to get out and cry<br>",
          "terrified but then I see the look in your eyes<br>");
       
for ($i=0;$i<4;$i++){echo $short_turn.$v2[$i];}
echo "$longturn<br>$longturn<br>";

$chorus="$need now tonight<br>
    $need more than ever<br>
    And if you only hold me tight<br>
    We'll be holding on forever<br>
    And we'll only be making it right<br>
    Cause we'll never be wrong together<br>
    We can take it to the end of the line<br>
    Your love is like a shadow on me all of the time<br>
    I don't know what to do and I'm always in the dark<br>
    We're living in a powder keg and giving off sparks<br>
    I really need you tonight<br>
    $forever<br>$forever<br>
    $time I was falling in love<br>
    But now I'm only falling apart<br>
    There's nothing I can do<br>
    $eclipse
    $time there was light in my life<br>
    But now there's only love in the dark<br>
    Nothing I can say<br>
    $eclipse<br>";
   
echo "<hr>$chorus<hr>";
echo "$rabbits <br>";
$short_turn="Turnaround, Every now and then I know ";

$v3=array("you'll never be the boy you always wanted to be<br>",
          "you'll always be the only boy who wanted me the way that I am<br>",
          "there's no one in the universe as magical and wonderous as you<br>",
          "there's nothing any better and there's nothing that I just wouldn't do<br>");

for ($i=0;$i<4;$i++){echo $short_turn.$v3[$i];}
echo "$longturn<br>$longturn<br><hr>$chorus<hr>";
?>

Sunday, 19 September 2010

How To Destroy The Universe - A Beginners Guide

Firstly, it should be pointed out that destroying the Universe is considered to be a little anti-social in many quarters, and may even be illegal under your local laws.  Please obtain professional legal advice before attempting it.

Secondly, you're not going to need the Large Hadron Collider.  Let's make it clear from the outset: the LHC simply isn't up to the job, and by many, many orders of magnitude.  Using the LHC to do what I'm going to suggest is like trying to set off a nuclear explosion with a small lump of Uranium ore and a toffee hammer, it simply isn't going to happen.

So with the obvious warnings out of the way, how are we going to destroy the entire Universe?  Simply blowing up a star or two isn't going to do it.  In fact, blowing up all the stars isn't going to do it, despite Steven Moffat's best effort in the last season of Doctor Who.  Even if you could make every star go supernova at once, the Universe would still be there...OK, it would be a Universe full of dust and ashes rather that stars, but it would still be there.  We're going to need a much bigger bang.

The bang we're looking for is something called 'vacuum decay', and it has nothing to do with household appliances.  A vacuum, to a physicist, is a rather complicated thing.  It's exactly what you're thinking of - an absence of matter, a space that contains no atoms, no molecules.  In the middle of the last century, however, it became apparent that a vacuum is never really empty, quite the opposite in fact.  A vacuum, even the most perfect one you can imagine, is a bit busy.  There's space and time for starters, and a plethora of 'virtual particles' popping in and out of existence the whole time...on the smallest scales a vacuum is a seething mass of weirdness.

All of this weirdness requires energy - even in particle physics, there's no such thing as a free lunch.  This energy is called, with remarkable clarity and lack of imagination, vacuum energy.  Depending on the theory you use to calculate it, the vacuum energy in a cubic centimetre of space is somewhere between 0.00000000000000000001 Joules and 1x10^107 Joules (a 1 with 107 zeros after it), so it's fairly safe to say there's a certain amount of uncertainty.

(As a point of reference it takes about 35,000 Joules to bring a litre of water to the boil)

Whatever the actual value is, the point is that empty space has energy.  There's no particularly good reason why our Universe has the amount of vacuum energy it does, in fact it could have values far outside our (already uncertain) estimates, and therein lies our method for destroying everything.

Now, not content with throwing some big numbers around, I'm going to drop a graph into the mix as well.  Don't Panic.  If it helps you can think of it as a picture of a rollercoaster.  In fact it will probably help if you do, because I'm going to stick with the analogy.  Here it comes, hold tight....



What this shows is a completely made up graph of the possible amount of vacuum energy in the Universe.  We're the little red dot.  Now, imagine pushing the little red dot to one side or the other...it'll just roll back down to where it started.  Push it a bit harder though, and it'll roll over the peak to the right and settle in a new position in the second, lower dip to the right, and a lot of energy will be released in the process (equal to the difference in height between the two dips).  That's potentially a lot of energy.  If you can push one tiny bit of the Universe, a sphere of just a few hundred metres in diameter, over the peak then it gives off enough energy to push the space around it over the edge, which pushes the space around that over the edge, and you have a bit of a chain reaction on the go. 

The bubble expands at nearly the speed of light, and inside it everything changes.  The very laws of physics, and by association those of chemistry and biology, alter, and not in a good way.

...one could always draw stoic comfort from the possibility that perhaps in the course of time the new vacuum would sustain, if not life as we know it, at least some structures capable of knowing joy. This possibility has now been eliminated. 
Coleman & de Luccia

 Voila, we've destroyed the Universe, at least as far as we currently understand it.  So how do we do it in practice?  Well, we need a very high energy density, something like a very, very big bomb to push it over the edge.  This was one of the "risks" associated with the LHC by people who didn't quite get the numbers (or "twats" as Brian Cox refers to them) - the energy densities created by the LHC are indeed very high, but they're nowhere close to high enough.  How do we know when there's such uncertainty over how much vacuum energy the Universe has?  Well several times a day cosmic rays slam into the Earth's atmosphere with very much the same energy density as the LHC's experiments.  Once a month or so we get hit by a cosmic ray with far higher densities even than that, and every decade or so there's a truly exceptional event which surpasses the LHC by hundreds of times.  None of these events seems to have triggered vacuum decay, after all, we're still here.  (So why have we spent so much on the LHC when nature regularly beats the pants off it?  Well the whole point is, in effect, to take a photo of the event with a very big digital camera, and we never know where and when the natural events will happen.)

Supernova, black holes merging, even gamma ray bursters, the most violent explosions ever observed, have so far failed to tip us over the peak and destroy the Universe, so we're going to have to dream up something else, an even bigger bang.

Which brings us to a curious little post-script, one best illustrated by a quote from Douglas Adams:
There is a theory which states that if ever anyone discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable. There is another theory which states that this has already happened.
 What if we're in a Universe where vacuum decay has already happened?  From the inside of the bubble it would look very much like a Big Bang....