Great cities

Yesterday I went to a talk about the mathematics of relationships and why people congregate in cities. The speaker argued that the average probability of two people having a relationship (any sort of relationships: client, employer, lover, friend…) is inversely promotional to the number of people in their social sphere. His definition of a social sphere was the people that are located in the area which you can travel to in less time than the other person.

The main point that came out of the talk is that distance in terms of time is more important than real distance. The best cities are those with a good transport network which allow many opportunities for relationships.

The talk explained why over 50 million people migrate to cities each year. Cities offer so many more potential relationships than the surrounding population.

I’d like to look into this topic in closer detail but I’m on holiday at the moment.

Science vs engineering

This evening I went to an event at the London Science Museum. Once a month they open the museum in the evening and put on special guests, talks, activities and alcoholic drinks.

It was a great evening with some interesting talks and some fun activities. What really struck me was the gender balance. I would (non-scientifically) estimate that just over 50% of the visitors were female. For me this seems really unusual as I’m used to men easily outnumbering women in all the engineering I’ve ever been to.

At university, about 25% of the engineers were female, at work less than 10% of the engineers are female. In fact government statistics say that only 6.9% of all professional engineers are female.

So is science really that different? Well yes in terms of the statistics. 40% of science professionals and researchers are female and the Science Museum say that 48% of their visitors are female.

I’d like to find out what is causing this huge difference, there is such a big overlap between modern science and engineering. Clearly, from the turnout at the Science Museum this evening, women really enjoy learning about science. I wonder what would happen if it were renamed the “Engineering Museum”.


In the soft evening light I took this image of a seagull standing above the surf. The cold weather has some benefits, more sunny evenings. I believe this is a great black-backed gull. I also managed to capture some other gulls:

Little gull
Little gull
Black-headed gull
Black-headed gull

Actually it turns out that telling gulls apart isn’t easy (those both might be black-headed gulls or little gulls)

Xmas game part 1

I like to do something special for Christmas. Most years I make my own custom Christmas cards. 5 years ago I produced a small game to celebrate and I want to try producing a Christmas themed game again.

Step one is to come up with a concept. I’ve spent a while thinking about this, the game needs to fulfil a few criteria:

  • It needs to be simple enough that I can implement it in a few days
  • The animation needs to be really simple (I have no real animation skills)
  • The game needs to be accessible, suitable for all ages and abilities to play
  • It needs to be fun
  • It needs to have some link to the festive season

After studying a few different types of games and thinking very hard about how I can produce a game I came up with the following idea. A platformer which involves a polar bear jumping between platforms. The game ends when the bear ends up in the water. Points are scored for each jump successfully completed between platforms. The game starts off easy with small gaps and large flat platforms. As the game progresses the gaps get larger, the platforms become smaller, inclined and slippery. The image at the top of the post is my first drawing of the concept.

The next step splits the game into two parts: the game mechanics and the styling. The game mechanics includes all the physics, rules and controls of the game whilst the style includes all the animation of the objects and all the different images and textures needed. Once these two parts are completed we can integrate them and test out the game.

I’m going to start with the game mechanics. There are two objects in this game: the polar bear and the platforms. The platforms will scroll horizontally to give the apparent forward (or backward) motion of the bear whilst the bear will move vertically to give its vertical motion.

There will be 3 inputs to the game, one input will make the bear run faster (accelerate), one will make the bear run slower (decelerate) and one will make the bear jump. The longer the jump control is held down the more powerful the jump. The jump is commenced as soon as the jump control is released.

I can now start putting together the equations to model the behaviour of the bear object. The bear has 4 parameters: horizontal and vertical displacement sx and sy and horizontal and vertical velocity vx and vy. At regular intervals (say 50 times per second) the forces on the bear are calculated and this affects the velocity parameters. The velocity parameters are then used to update the displacement parameters. Once the new displacement parameters are known, collisions can be detected. I’ll come back to collisions.

First lets look at the forces on the bear. When in the air there are two forces affecting the bear: gravity and air resistance. Gravity always acts only on the vertical component and has a constant effect of magnitude g (gravitational acceleration). Air resistance acts proportionally to the velocity of the bear in the direction opposite of the velocity. We can easily split this into a vertical and a horizontal component.

This gives us our two equations:

vxn+1 = a * vxn

vyn+1 = b * (vyn – g)

where a is the horizontal aerodynamic parameter, b is the vertical aerodynamic parameter and g is the gravitational parameter. (a and b can be the same or can be different to give slightly more adjustable physics)

When on a platform there is a further force from the player controlled acceleration/deceleration. We also need to consider the effects of slippery surfaces. The amount of friction between the bear and the surface limits the force in the direction of the surface of the platform.

We can model this as a velocity in the direction of the surface of the platform.

vsn+1 = c * (vsn – g * sin(θ) + d * cos(θ) + e)

where c is platform aerodynamic parameter and d is the friction parameter and e is the player controlled acceleration parameter.

Finally we have a force from jumping, since a jump is instantaneous we simply add an amount of velocity depending on how long the jump control has been pressed for. The jump is always normal to the surface of the platform.

It’s very difficult to give exact numbers for each of the parameters. The parameters give the game it’s feel. We can give more or less gravity, make the bear faster or slower, make the bear more or less responsive and the platforms more slippery. To get a feel for where the game feels right requires some testing.

Finally we have collision detection. If we are currently on the platform we are testing for whether the bear has gone off the edge of the platform. If we are in the air we are testing for if the bear has hit anything. We test if the bottom edge of the bear bounding box has hit the water or the top of a platform and we test if the right hand edge of the bounding box has hit the side of a platform. Only in the case where the bear hits the top of the platform does the game continue. The velocity of the bear in the direction of the surface of the platform is set as the new velocity with the normal component discarded.

This translates to quite a number of rules and equations but put them all together and you get this demo. The platforms are the red objects, the bear is the yellow object. The arrow keys control the acceleration/deceleration and the space bar makes the bear jump. It’s not the finished article by any means but it gives a framework to start from.

Next time I’ll be looking at producing the graphics for the game especially the animation of the bear.

Remembrance and thanks

Today, I went to a memorial service at the magnificent Lancing College chapel ( the right hand building in the photo at the top of this post). It was mostly a service to remember those who died in the Shoreham airshow crash and to recognise the efforts of the emergency services.

It was a bitterly cold day, getting to Lancing I walked over the Old Shoreham bridge. This bridge, once covered in flowers, was now covered in brightly coloured ribbons. To me it was rather chilling to see hundreds of ribbons waving in the breeze. It did remind me of loss. The personal tributes, flowers, mementos and messages had all disappeared, everything was stripped back to these plain unattributable ribbons. It reminded me of the simple grave markers and the bright poppies we use to commemorate those who’ve died in war.

The mood of the service itself was sombre interjected with brief bursts of positivity. Silence was the most powerful aspect of it. A minute silence was held at 1:22pm to mark 3 months since the accident. It was the quietest minute of silence I’ve ever experienced amongst so many people, there were no coughs, no crying children, no rustling of paper, nothing. The thick walls of the chapel and the huge space made the silence feel particularly ominous. It was like being the only person in the building.

There were many more moments of silence only filled by the deep and powerful sounds of the organ. It was clear that everyone was lost in their own thoughts and memories. There was a definite sense of sadness and loss.

For me it was a slightly surreal experience. I didn’t know anything much about the victims being remembered. The service wasn’t a personal one, there were readings by some of the families and friends but there was no indication of who they were or why they had chosen their readings. They probably had a lot of meaning for those who knew the person they were remembering but I struggled to relate.

For me the event was an opportunity to say thank you. After the service I was able to speak to members of the Red Cross who had been at the event. It was nice to see a few familiar faces, people who had helped me that day. I was able to show them that I had recovered thanks in part to their efforts. They joked that it was nice to see me wearing clothes as opposed to being wrapped in a foil blanket!

I also had a chance to speak to members of the ambulance service and police force to thank them for their efforts. For the emergency services, they were just doing their job but I think it’s very important to show gratitude and show them how much their job really means to real people.

A letter to Andy Hill

I’ve been invited to the Shoreham Airshow Memorial Service tomorrow. I don’t think the pilot in that incident, Andy Hill, will be there but I’ve been thinking about what I’d say to him if he were.

In many ways Andy Hill is much luckier than me. Nobody thought any pilot would be able to survive such a horrific crash. I was quite surprised when I heard the news that the pilot had been taken to hospital. I was even more surprised when it was announced that he had been discharged from hospital only a week after I had been discharged.

Planes aren’t really designed to crash into the ground but somehow the impact had so little vertical velocity that it didn’t kill him. And somehow his seat managed to come detached from the main cockpit structure such that he wasn’t badly burnt in the ensuing fire.

I’m sure that he was hugely helped by some excellent emergency responders and the air ambulance which transported him to hospital. As it turned out I believe he was the only person who suffered life threatening injuries.

I don’t think I’ll ever know the full reason why the Hawker Hunter hit the ground in front of me. I’m not an investigator however I know a little about aeroplanes, I’ve watched the videos of the crash many times and I’ve read the preliminary report compiled by the Air Accidents Investigation Branch (AAIB). The report comes to no conclusions about the cause of the accident. The only tiny piece of new information it offers is that there were cameras in the cockpit recording the flight and they seemed to show that the aircraft responded to the pilots inputs.

It’s not my job to investigate the accident nor should I really speculate on the cause as I’m not an expert however my best guess is that the incident was at least partly due to pilot error.

When performing an aerobatic manoeuvre such as that fateful one, the pilot has to make a decision at the highest point of elevation. If the pilot hasn’t achieved the necessary elevation, or there is some sort of malfunction then the pilot simply pulls the plane out of the turn, rolls the plane upright and starts again. Since the pilot didn’t do this, we have to assume 3 options: he was at the necessary elevation with no malfunctions, his elevation was too low but he didn’t realise or a malfunction prevented him from pulling out of the manoeuvre.

The first two options are the only plausible ones given the report which stated the plane was responding to inputs and the fact that in the videos, the pilot still appears to have some measure of control.

If we assume everything was fine at the top of the manoeuvre, then we have to ask what happened between that point and hitting the ground. Loss of power isn’t an issue as the plane is descending and there should be enough elevation to get back to level flight even without power. Loss of control is another option. In the videos I’ve seen it seems like the plane reduces the rate of pitch before it achieves level flight. Again there can be multiple explanations for this: the pilot might have momentarily lost control for some reason (passing out, losing sight, becoming distracted), a control actuator may have broken or the plane may have stalled, this is when the plane is pushed beyond it’s limit and the wings instead of generating more lift generate less lift.

I think we can probably discard a control actuator malfunction or a stall as this would appear at odds with the AAIB statement. In summary we’re left with two plausible options (or a combination of both). The pilot made a mistake about the elevation required to complete the manoeuvre safely or the pilot momentarily lost control of the aircraft.

Even though I think pilot error was probably partly to blame for causing the incident, that does not mean I blame Andy Hill. Most of us make small mistakes every day; I know I make lots of small mistakes at work. On 4 or 5 occasions in my life, I’ve temporarily lost my sight. It doesn’t go instantaneously, the times it’s happened I’ve been able to sit down and wait a minute or so for my sight to come back. I’ve never been to a doctor about this, I don’t think it’s serious enough. But if it happened again at the wrong time, I could be driving a car on the motorway, it could cause someone other than me to get injured.

I’m not sure whether I’m doing the right thing about that, but I don’t want some minor condition affecting what I can and can’t do. I take risks and that day at the airshow, I took a risk, I sat somewhere where planes were flying over my head.

So here’s my letter to Andy Hill:

Dear Andy,

Firstly, I want to say I’m not blaming you for what happened to me that day at the Shoreham airshow. I hope you’re recovering well and you can get to a day in your life when you don’t think about the accident.

You probably know better than anyone what happened just before you hit the ground. I’m interested in what happened simply to satisfy my own curiosity.

I don’t mind if I never get to know but I think it’s right that the investigators know so they can prevent future injuries.

You inadvertently gave me the most thrilling memory of any jet plane. If your Hunter hadn’t hit the ground I’d have probably got an incredible close up photo and a huge rush as it came over my head. Sadly that wasn’t what happened and I wish I could roll back time to prevent it.

Finally, I hope that if you want to, you’ll be able to fly planes again. If you’re ever back in a Hunter again, I’d love to try and get some decent photos!

Best wishes,

Thomas Milburn

Blogging one week on

It’s been just over a week since I started this blog. Even in a week I feel like it’s got easier to write posts. I feel under less pressure to write something good, instead I feel free to write about what I want.

The thing I’ve enjoyed most about my blog is choosing the photos to use at the top of each post. I have a varied collection of photos so it’s not too difficult. It’s nice to have a use for my photos, they’re not the most important part of this blog however they make it feel more personal and add another splash of interest.

To be quite honest, I know nobody has actually read most of the things I’ve written about so far. That doesn’t worry me that much, it takes time to pick up a readership (I haven’t publicised this blog anywhere) and I know that posts from my old blog are still being read a whole 7 years on!

Road running to recovery

I went out for a 9 mile run this evening with my local running club. Foolishly, I started out at the same pace as the fastest guys (whom I usually keep up with) and my leg still isn’t fully recovered. After about 5 miles I could feel my left leg starting to cramp up so I had to lay off the pace. I then had a leisurely jog back home.

It’s my aim to get back to my original level of fitness by the end of November so I’ve been on a fairly intensive exercise regime. I’ve tried to go out running 3 times a week, swim twice a week and a long walk at the weekend. It seems to be working, a month ago I couldn’t really jog at all. 3 weeks ago I was right at the back of the running group, having to walk some of the session. From my run this evening I can see that I’m almost managing to keep up with the fast group. Another two weeks doing this amount of training and I should be right back up there.

Perhaps also foolishly, I’ve entered next year’s Paris Marathon. The marathon website tells me I’ve got 135 days to go (it’s in April). 135 days sounds like a lot however 20 weeks doesn’t sound as much. I’d like to start on a proper marathon training schedule in December.

Marathon training is tough especially when you’re as competitive as I am! I’ve never ran under 3 hours in a marathon (3:01 is my best time) so my aim is to break that elusive 3 hour mark. I know that means a lot of running between now and April. I will probably need to dedicate about 10 hours each week to training and up my mileage to at least 50 miles each week.

It’s a good target to aim for and it’s been good motivation to get me out of my flat when it’s dark and wet.

The moon

It was dark on my way back from work and I could see the moon shining through thin clouds. I decided this would be a good chance to try a little astro-photography. I went out with my camera and after a little wait for the clouds to disappear I snapped this. It doesn’t show a great amount of detail but it’s not bad for a first attempt.

You don’t need a telescope to take a good photo of the moon. The moon is actually a really bright object in the sky. What you do need is a tripod (or something similar to keep your camera still) and a fairly long lens. I have a 300mm lens which is equivalent to a 600mm lens on a standard 35mm camera. The length of the lens is important but for night time photography so is the sensitivity and size of the sensor (both in pixels and physical size).

A smartphone simply doesn’t have the sensor size or length of lens, however a lot of modern bridge cameras (which can be found for less than £100) have very long lenses and relatively large sensors. Photography doesn’t have to be expensive!