Sometimes Models Make Reality

Ok, so it’s important that we understand that there is a distinction between the models, or paradigms that scientists use and the real world. But when I first started to think about these things I got a bit confused. What about computers? Computer people always say “that’s not possible” without any hint that there is a chance that their understanding of how a computer works could be wrong. Unlike scientists, they are, normally, right.

The reason for this is that computers are a special case of building a model. In contrast to science, where we are actually theorising that maybe this model describes the world, when we design computer systems we are building a model, and then deciding to accept whatever the model says as fact.

Let me switch examples now – many people find computers too confusing to follow. The same is true of an election, such as the UK general elections. A model for how to count the votes and how to interpret them has been created. It is available from the government, and its intricacies have been studied in great deal. It’s not a perfect model, though for elections, there is no such thing.

This model gives us a prediction. Once we know how everyone in the country has voted, we can predict who will be the “most fairly elected winner”. At this point, in a scientific model, we would go and measure who the “most fairly elected winner” was, and compare that to our model. In elections, we take the answer from our model, and enforce it in the real world. Computers are the same, although the models are more complex.

The reason I got confused when I first came across this, is surely computers are real, physical things, which obey the real world, why should they obey our models any more than anything else does? It took me a while to figure this out.

Computers are at their most basic level built on semi-conducting transistors. We have a very good (scientific) model of how these work, but perhaps more importantly, for a reasonably small range of conditions (those that exist in a computer) we have looked at them, and observed them, and measured them in enough detail to know how they respond. They have a nice set of properties: they can be configured take two yes/no inputs and produce a yes/no output, in a variety of behaviours. These ways behave exactly like some of the basic logical concepts (AND, OR and so on). So we can use transistors to build a logic engine. A machine that is capable of manipulating our logical models. All that is required is that the behaviour of our transistors doesn’t suddenly change. We then build out logical models in the computer (programming). The “Microsoft Word” model says that when it receives an input showing that the “A” key has been pressed; the state of the screen should be updated to add the letter “A” at the cursor position. We then accept this as reality. Because the model in the computer says there is an “A” there, then there is.

By |January 23rd, 2007|General|0 Comments

Believe Data, not Models.

I recently wrote about what a scientific model is, and what are the limits of using models. Briefly, you can’t prove that the language used (logic) is consistent, and you can’t prove that the model really maps onto the world.

Now I want to talk about why it is important for scientists to understand this, and what happens when they don’t If you have ever spoken to anyone who has studied science (and if you are reading this the chances are you have) then you will probably be familiar with announcing that things are not possible. I remember once being told that it was not possible to heat a plate in a microwave, as they contain no water.

There is a fundamental problem here, and that is that it’s so easy to construct a model, and then accept it as some invariably true thing. The fact is that we never know if our models are true.

Let’s go back to the microwave comment. If our model of a microwave is that a it heats up the water in the object placed within it then you can follow that line of reasoning and say plates don’t contain water, so can’t be heated. There is just one problem, go and put a plate in the microwave. You will find out it gets hot.

So we need to reassess our model. Modify it, until it does predict what actually happened. In this case we need to add in the fact that there may be some water in the construction of the plate, and there will be some moisture in the air, which will heat up and then conduct heat into the plate. Now our model says that indeed the plate will get hot.

The point here is not how we adapt models though. The point is that far too often, we simply consider what our model says, and then announce what is possible, and what isn’t. Far too often do we fail to actually look to see.

This is the distinction between a good scientist, and a crap one. It can be as simple as saying “I don’t under stand how that could happen” instead of “that can’t happen”. Most scientists are good at this professionally, but slip into bad habits in their own internal thinking. We should always remember that our job is to try and explain what does happen, not to prescribe what will happen.

By |January 16th, 2007|General|1 Comment

Saturday night hospital incident

On Saturday night my grandfather suffered a transient ischaemic attack.

I got out of the tube, on my way to meet friends to discover a voicemail from my mother. She was in the emergency resuscitation ward of the Homerton Hospital with my grandfather, who had suffered an incident of some form.

Since then he has recovered, and even been discharged. He is doing well, and is even telling more jokes than he used to! However his heart did stop beating for a short about of time. Mum has written a more detailed post on her blog about what happened.

By |January 8th, 2007|General|0 Comments

Checking that it is true that true is true should not be hard!

I spent most of the last day or so playing with testing in ruby on rails. It should be pretty easy, after all rails has testing built in, right? Well that’s what I thought, and I was right, but only to a point.

Starting off with a simple example

class ItemTest < Test::Unit::TestCase def test_truth assert true end end

Not much to go wrong there. Check if true is in fact true, and if it is, say its true. Always best to start with a trivial example - something that clearly will work. Of course, this is the real world. Did it work? Did it hell!

Instead I get printed a nice little line telling me that there is an error in testing.rake, line 35. Looking at line 35, it is a pretty simple little line: “If there was an error, show error message”. Great, this is going well.

I probably should tell you a bit of background here. I’m not trying to use a database. All my data is going to be obtained from a nice sexy web service, in a way that is really quite cool, but apparently beyond the expected uses of RoR. James Andrews pointed me in the direction of recipe 14 of Rails Recpies, and a blog post on databaseless rails application testing. Both were of course out of date. So here is what you need to do, of course, this only works for ruby 1.1.6 for sure, and revision of 5832 of edge rails. Who knows if it will work for any other version.

1) Change the file test/test_helper.rb so it reads as follows:

ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require_dependency 'application'
silence_warnings { RAILS_ENV = "test" }

require ‘test/unit’
require ‘action_controller/test_process’
require ‘action_controller/integration’
require ‘action_web_service/test_invoke’
require ‘breakpoint’

class Test::Unit::TestCase
# Add more helper methods to be used by all tests here…
end

This basically just removes any reference to databases from the test framework

2) Add a file in lib/tasks called something like “remove_database_dependency.rake” and put the following in the file

["test:units", "test:functionals", "test:integration", "test:recent", "test:uncommitted"].each do |name|
Rake::Task[name].prerequisites.clear
end

This goes through all the rake testing tasks, and removes all of their prerequisites (which in my version of rails only consists of loading the database)

There you go, after all of that, you can now tell that true is true!

By |January 4th, 2007|Uncategorized|0 Comments

When Scientific Models End

Finally I have managed to describe what I want to say about how science works. The concept of a model, that can be manipulated by some tools, and that there are similarities (isomorphism if you want to be pompous) between the model and the way the real world works. I have also explained, though probably not very clearly the problem that logic, the tools science uses to manipulate its models, cannot be proved to be consistent – though no inconsistencies have ever been found.

The next problem is that of what exactly the similarities (isomorphism) to the real world mean, and can we rely on them. Something almost every school child is taught are Newton’s Laws of Mechanics. These describe a model of, say, a tennis ball being struck by a tennis racquet. When you look at a real tennis ball, being hit by a real tennis racquet, then the results are the same. If the model ball goes 106 meters, then the real world ball does too. At least, it does when you make sure your model includes all other factors that apply in the real world, like air.

For a long time, this was fine, and everyone thought that it would always be fine. This is called the problem of induction. It works as follows: “We have compared our model to the real world on many previous occasions, and it was always similar. So it will always be similar.” This is a bit of a leap of faith. We do not know the future, and so we don’t know that the next time we test it it will still work. In reality we assume that it will work, and the first time we find a case that it doesn’t work in, we have to modify our model.

Newton’s Laws of Mechanics, as it turns out, did not work for all time. They only worked until we were able to look at things moving very fast. Then Newton’s model starts to give answers that do not match what we see in the real world. But we can use a more complex model – one that Einstein created called Special Relativity, which still gives the right answers.

The same problem might be there for every single scientific theory we have. They might well only agree with the real world for a range of situations, those that we are able to recreate and then examine. There is even the (probably very remote) chance that they only work agree with the real world on dates before tomorrow…..

Most of this is purely academic though – unless it turns out that the models are only of any use before a certain date. We have spent a lot of time recreating scenarios in the real world, and checking to see if the models agree. Those that don’t are forgotten.

By |January 3rd, 2007|General|3 Comments