Tuesday, 21 October 2008

There's a monkey sitting at a typewriter

Mathematics is the language of science, so having a grasp on the mathematical concepts used is vital in order to understand much of what is written. Understanding the difference between coincidental and causal events is vital in order to understand statistics. Our brains work on linking causal events, if I press the 'x' key on my keyboard I expect there to be an 'x' written in my text editor. Likewise, all the keys on the keyboard have function and using that same causal relationship I can write entire blog posts. I am conveying information in a causal manner. Now what if it were random? Could a random generator recreate a post of mine, or even a single sentence?


Generating improbability
Now there's a few ways of going about this, take the sentence "mathematics is the language of science", taking the lower-case alphabet and the space character, there are 38 spaces and 27 different characters to go in each. Note that Dawkins did a similar computational experiment in The Blind Watchmaker.
  • random chance - suppose you tried to generate every position and every character at once. To get the first character correctly would be a 1 in 27 chance. As would generating the second character. To generate both characters correctly would be (1/27)2 or 1 in 729. To generate three characters correctly would be (1/27)3 or 1 in 19,683. To generate all 38 characters correctly would be 1 in 2738 or 1 in 2.5*1054. So for this one off event to happen, it would take an extraordinary amount of time to generate it by chance with purely random input.

  • cumulative chance - instead of trying to generate it all in one go, generating each character individually could work better. Start with the first character, and there's a 1 in 27 chance of generating 'm'. So when 'm' is finally generated, move onto trying to generate the 'a'. Now each subsequent character generation is dependant on earlier chance encounters. To generate 'math' now becomes (1/27) + (1/27) + (1/27) + (1/27), or 1 in 108. For all 38 characters, it's (1/27) * 38 or 1 in 1026. So by progressively doing each step along the way, it takes away an extreme amount of improbability.

  • evolving chance - back to generating in one go. By starting at an arbitrary point and tweaking the string, eventually it will come up with the right answer. The mathematics for this is not easily expressed, though it can be expressed in code.


The results
I wrote a java program to simulate these different processes. The source code is available here for anyone wishing to run it themselves. Feel free to modify it, and push it to it's limits. It's very much a cobbled together hack-job, there wasn't much focus on having a clean interface. It's there to show I didn't make the results up, and while the randomness of the PC will mean that the numbers will not turn out the exactly same as mine, they are a good approximation of the procedure.
  • random chance will not generate a computational answer, computer randomness is based on seeds so it will run infinitely without ever finding the answer. If it were truly random, then it would still take an almost infinitely long time. I ran the program quite a few times and there wasn't even a fragment of any word that could be considered English.

  • cumulative chance has yielded similar results to the mathematical prediction of an average of 1026 iterations. Running it 10 times, I had the following results: 1058, 867, 1077, 1403, 776, 943, 1081, 893, 945, 880. This is an average of 992 iterations for the result. Doing it again for 10 iterations yielded the result 1028. A third time with 100 iterations yielded an average of 1008. A few more times and I did get 1026 as the average over 100 iterations. The practical application of statistics correlated with the theoretical application.

  • evolutionary chance brought an even quicker result. By adjusting the amount of mutation (a mutation rate of 1 would mean 'd' could only change to either 'e' or 'c', 2 would cover the spread from 'b' to 'f'), the length of time could decrease. The results for running it 100 times on different mutation rates were as follows:

A run through with a mutation variance of 5
Iteration: 1 tptvelwhiqt irsirfpokxpub skrjcgrhcslt
Iteration: 2 - qrtyekzgimy iunhtirkibrubetjuhelueerot
Iteration: 3 - nqt efxfiru irmkojmmkdquddqesjeoxieoov
Iteration: 4 - rmtzedthiov ivmoohqrkdsufencsfhquiesly
Iteration: 5 - whteedtiity iyktnkpulfnudjmcrfgnuiewpz
Iteration: 10 - tftjeclaiww ivdtocswahguajjo fodwieurb
Iteration: 20 - hvtheixaifs in tfwlladguarexffqjpievcr
Iteration: 30 - natheoetias is thyhlamguadeohfinsieucx
Iteration: 40 - mathematigs is th tlacguaoepcflnniescg
Iteration: 50 - mathematics is th uladguauewdformiemce
Iteration: 60 - mathematics is thdilajguabe lfdskiebce
Iteration: 70 - mathematics is thwtlacguaje ofksniefce
Iteration: 80 - mathematics is thkjlauguape of syievce
Iteration: 90 - mathematics is the language of snience
Found iteration 97 - mathematics is the language of science


And what of those monkeys?
The first two methods would be simulations of how a monkey would type: the first method would be the equivalent of letting a monkey type the entire post and have it start from scratch over and over if there would be any errors. The 2nd method is like the monkey using the backspace key each time it got something wrong. The evolving algorithm is unlike random chance, it's to illustrate that information of almost infinite improbability can emerge over a far shorter space of time.

Including white space, my posts average around 7,000 characters. By the time a post is finished, the amount of characters I press is probably a lot higher when taking into account typos, spelling and grammatical errors, deletion of poor sentences, and proof reading. All up, it wouldn't be entirely unfair to say I do about 10,000 key strokes per post. Now if I do 200 keystrokes a minute, then it would still take me 50 minutes or so to get the post to where it is now. To evolve or generate something like this by chance is theoretically possible, but practically impossible.

This is why when we see a code or information we know there's intelligence behind it. To look on the great pyramids, the symbols contained therein are the product of intelligence and intent. Anyone who has had previous dealings with the written word would be able to understand the symbols are the same construct. To go back further into human history, the same could be said of cave paintings. It is not the refined symbolism of the written word, but it's evidently communication. Other forms of communication do exist that are not so obvious, smoke signals for example. There are times too when we can mistake natural order and randomness as communication, the stars say astrology is a joke and our futures are not etched into the palms of our hands.

We can infer meaning from non-meaningful processes, this is the problem with the statement "all codes are a product of intelligence". We see patterns all through nature, improbable shapes, repetition, improbable assortment, all of which come from natural processes. One of these patterns is the pattern of DNA, the double-helix structure that has the instructions on the building blocks of life. How could this occur naturally? Well, that's for another entry. The importance of the tests above what to highlight the difference between random chance and a cumulative or an evolutionary process. It was to show that improbable events can be created quite quickly using select processes.

Monday, 20 October 2008

Welcome To The Universe



I'm really looking forward to this series, AndromedasWake has made several high-quality videos so far. It's always good to see the time and dedication people are putting into furthering the cause on knowledge on a place like YouTube, goodness knows public understanding of science is severely lacking.

Saturday, 18 October 2008

Fanning the flames of hatred



Will we ever progress in society when there's pride in being an ignorant racist?

Friday, 17 October 2008

The Atheist Blogroll

Kelosophy has been added to The Atheist Blogroll. You can see the blogroll in my sidebar. The Atheist blogroll is a community building service provided free of charge to Atheist bloggers from around the world. If you would like to join, visit Mojoey at Deep Thoughts for more information.

Thursday, 16 October 2008

Dumbing Down The Media

Yesterday I came across a great article on Crikey written by Paul Collins on the decline of journalistic standards on our national broadcaster.

Words tell you everything. When you hear "interdisciplinary" you know it means "dumbing down" and "consumer focused" always refers to the lowest common denominator. This is precisely the rhetoric used yesterday by ABC Radio National management to describe their intentions for RN programming next year.

Several specialist programs are being taken off-air including the Religion Report, the Media Report and Radio Eye. The Reports are flagship programs that deal with issues central to current culture. Apparently they are being replaced by a movie show and something about the future. Specialist broadcasters will spend more time responding to opinionated bloggers rather than making programs. God help us!

Let's be clear what ABC Radio management is up to: it is a case of the bland leading the bland. Specialisation is out. Nowadays the belief is that any old (or, more likely, young) "interdisciplinary" journalist can deal with any topic. Well, I've been interviewed literally hundreds of times on ABC radio and TV. My experience is that while most journalists make a reasonable go of it, they just don't know the detail and often have to be led to the key questions.

Take religion for example. There are no more than half a dozen specialist religious journalists in Australia. Two work for Fairfax (Linda Morris and Barney Zwartz) and the rest for the ABC which has had a religion department since the beginning of the Corporation. Stephen Crittenden, John Cleary and Rachael Kohn are able to cover a complex spectrum of beliefs, practices and theologies from a wide cross-section of traditions precisely because they are specialists.

Nowadays religion is a mainstream political, cultural and socio-economic issue with enormous impact on world affairs. To cover it adequately you need specialists. That is precisely what Stephen Crittenden has done on the Religion Report. He knows what the issues are and where the bodies are buried. Sure, he's upset some powerful people, but that's the nature of a free media.

I'm not paranoid. I don’t see this as an attack on religion. It's more a lack of appreciation of specialization, derived from the half-witted, post-modern conviction that everyone can do anything. Sure, they can ask a few prosaic, "man-in-the-street" questions. But that's not the task of Radio National. If you think it is, get a job with the commercials.

We need to be clear where this is leading. It effectively spells the end of religion as a specialization in the ABC. If you only have a couple of minor, essentially life-style programs on air you don't need people who know their stuff. All you need is an 'interdisciplinary, consumer-focused' approach, produced by the type of journalist who doesn’t know the difference between an Anglo-Catholic and an Evangelical!
He said so eloquently what I clumsily tried to say. The need for experts cannot be overstated, especially in areas that matter. The journalists who give the news are the teachers of the general population. They need to be trained in the areas they cover as their voice has influence on the general population. The domain expert has been lost in mainstream media, and if what Collins is saying is true, then it's sad that our national broadcaster is sacrificing quality for ratings. This opinionated blogger has nothing but respect for Paul Collins.