Monday, 29 August 2011

modelling reality

Lord of the Rings in three volumes
I first came across the difficulty of modelling reality when I designed a database for my books. This was back on the early 1980s when I was a physicist, and had barely even heard the word "database" before I got ViewStore for my BBC Micro. What's a book? Easy, you might think. But what about Ace Doubles? (two novels in one binding). Or a novel in three volumes? Or the same book with a variant title? Or a new edition? Or a translation? Or an abridgement? Or a book published over several editions of a magazine? Or...

various alphabets
The next big realisation was alphabets. In the 1990s I was involved in the international standardisation of the Z formal specification language. We needed to standardise the character set, which included lots of mathematical symbols. And our Japanese collegues wanted non-Latin alphabets. How hard could it be to allow different alphabets? So I went off to read the Unicode Standard. Oh.

I was remined of these issues when I saw a post by Charlie Stross discussing the post "Falsehoods Programmers Believe About Names" by Patrick McKenzie. People's names are difficult to model.

So is time. Different calendars. Calenders with negative and positive years, but no year zero (which is why some people ended up celebrating the 2500th anniversary of the Battle of Marathon a year too early). Changing calenders from Julian to Gregorian -- give us back our 11 days (of tax payments, that is). Changing calenders at different times in different countries. Leap years. The algorithm for leap years (and the difference between the Julian and Gregorian algorithms). The argument about whether the year 2000 should be a leap year. Time Zones. Changing time zones. Summer time (aka daylight savings time). Summer time coming and going at different days in different countries. Double summer time. Leap seconds. And so on.

One of the comments in Charlie's post references "Gay marriage: the database engineering perspective", a post with an interesting analysis of marriage database design (ignoring the name problem), and how some designs make changes harder than they need to be.

Notice the continual use of "ids" in that post. Names (even if we decide how to model them adequately) are not unique, and so are not suitable for an identifier. What properties might make a good unique identifier? I recall hearing of a new police database that used "Surname, initial, date of birth" as a unique id. The story goes that this database was installed a few days before the Kray twins were arrested...

In fact, no attribute is immutable, and so should not be used in such an identifier. The same person who told me the Kray twins story also told me of the problems a hospital had in assuming that the "sex" entry was immutable when they did their first sex-change operation.

Wait a minute. No attribute is immutable? What about "date of birth" (dob)? How can that change? Well, remember this database information is a model of reality, not reality itself. Models can have errors. The dob might have been mis-entered, or been lied about (when my maternal grandmother died, the family discovered from her birth certificate that she was 10 years older than she had let on to her children), or it might simply be unknown.

How I killed Pluto
So ... if modelling designed (social) reality is this hard, why are we surprised that it is hard to model the natural world? If our own names, dates, whatever, refuse to fit some neat classification system, why should biology, geology, astronomy? Is a virus alive or not? Is something a separate species or not? Is Pluto a planet or not? When reality doesn't fit our classification, the fault lies not with reality, but with the classification system.

Thursday, 25 August 2011

the future price of electricity, part 3

So, in June I blogged a follow-up to the weird estimate npower gave for my future electricity bills. Two months later, and I've had my next quarter's bill (differently weird, there).

The estimate seems to have gone back to a more reasonable amount this time around, so I'm no longer fearing an order of magnitude increase in power bills. I wonder what caused the original glitch?

But I'm going to keep a close eye on these estimates in the future.

Saturday, 13 August 2011

foreign power

I've just returned from a conference in France, having taken my new phone with me. Since the powered-on phone lasts about a day before it needs recharging, and since UK and French power sockets are incompatible, I needed a mains plug adaptor. I took two, and they both worked fine.

I took the cheap and cheerful "Tourist Mains Travel Adaptor". The reviews are contradictory about whether it works in France: it does. The product shown in the advert photo wouldn't, mind you, as it has no hole for the French earth pin (below left). But the one delivered to me does (below right). It's small, light, and cheap.

Tourist Mains Travel Adaptor

Because I wasn't sure if that one would work, I also took a "Swiss Travel Products World Travel Adapter": more expensive, and definitely snazzier. This does the full (UK or EU or US or Australia) to (UK or EU or US or Australia) conversion: it has four sets of sockets on one side, and buttons to extrude one of four sets of plugs on the other. Since all the plug pins can be retracted (below, left), it makes it convenient to carry. I tested the UK plug extrusion (at home), and the EU plug (below, right) in France. The slimline plug has no need for a hole to take the French earth pin.

Swiss Travel Products World Travel Adapter

Verdict: both work. The smaller cheaper one is fine for France. The larger, more expensive one means you need only the one device for all your foreign power needs.

So I had a fully charged phone all week, and could neurotically check my email several times a day.

UPDATE (27 Aug 2011): they both work in Norway, too.

Sunday, 7 August 2011

seeing is believing -- orly?

We've all grown up with standard optical illusions -- the Ponzo illusion of converging lines making identical objects appear to be different sizes, that kind of thing.

The squares marked A and B are the same shade of gray
These illusions have been getting more sophisticated.

There's a whole set of colour illusions. First of all there are the ones that show two identically shaded squares (A and B), but one appears white, one black, due to our vision perception "correcting" for shade. Then there are ones that make black and white photographs appear to be in colour, thanks to a persistence of vision effect.

There are aural illusions, such as the ever rising or falling Shepard tone, too.

experience the McGurk effect
Aural and optical channels can be combined. I first came across the McGurk effect a few years ago. In this a person speaks a particular simple repetitive sound, and the sound you percieve depends on whether you listen only, watch only, or do both. Weird.

Although these are fun, and weird, I feel I have some kind of handle on how, and why, these happen. I think I can see what's being fooled. But then, via Phil Plait's Bad Astronomy blog, I came across the "Flashed face distortion effect". Watch the video at You Tube. If you look at the individual faces, they look fine. But if you stare at the central cross as the faces flash up, "some faces appear highly deformed, even grotesque. The degree of distortion is greatest for faces that deviate from the others in the set on a particular dimension (eg if a person has a large forehead, it looks particularly large)."

watch this video

Now this is really weird. Disturbing, even. To me at least, some of these faces appear almost alien -- until looked at directly. I'm seeing stuff that isn't even there!

These illusions with their ever-increasing sophistication demonstrate how much better our understanding of perception and cognition is getting. And this increased understanding is showing how very fallible our perceptions can be. It graphically demonstrates the need for rigour, validation, and repeatability in observations, and just why anecdotal evidence should be so suspect.

Friday, 5 August 2011

Other minds, other worlds

I've recently read Devlin's Logic and Information. One example he gave in there got me thinking at a tangent; on p.103 he says:
Just as when you are thirsty you don't concern yourself with the complex biochemical processes that led to that state. Nor do you try to analyze just what constitutes that state. You may, conceivably, just say to yourself "I'm thirsty." Usually though, you simply go and get a drink, and think no more of it.
iced water
I have a somewhat different experience.

When I was younger, I got thirsty but didn't realise it. I got mild dehydration sometimes because of this. When I was a student, I once gave up coffee for a week, just to see if I could. I didn't crave coffee, but I had a constant bad headache, so decided the withdrawal symptoms weren't worth it. Only later did I realise the headaches were mainly dehydration: when I gave up the coffee I didn't think to substitute anything else.

Later on, I started making a connection between a certain physiological state---a particular feeling in my mouth, throat, and head---and the fact that if I didn't drink something soon, I would get a headache. I eventually deduced that this physiological state must be what people refer to as "thirst".

Now, when I recognise that state, I say to myself "ah, I must be thirsty", and go and get a drink. But I definitely do have to think about it. The experience is almost totally intellectual, and quite easy to ignore (despite the foreknowledge of the headache), qualitatively unlike hunger, where something inside me is going "food, food, food! now!!"

Okay---writing all this has made me recognise that I'm currently experiencing that physiological state again---I've analysed the state, and decided it means that I must be thirsty. So, having thought about it, I'd better go and drink a glass of water.

Wednesday, 3 August 2011


In preparation for my imminent trip to France, I was experimenting with my new toy, to check that the expensive roaming option wasn't enabled. In doing so I managed to switch off all data network access. Trawling through the menus, I came across a "Use packet data" option, disabled. I wanted to check that this was the problem, so decided, for a change, to RTFM. I downloaded the 5.7MB pdf from the relevant website. This is the totality of its entry for that menu option:
Use packet data: Set to allow packet switched data networks for network services.
Well, gee, thanks.

If you want them to RTFM, make a better FM