This weeks guest blogger, Peter McOwan, is currently a Professor of Computer Science and Dean for Taught Programmes in Science and Engineering at Queen Mary, University of London. His research interests are in visual perception, mathematical models for visual processing, in particular motion, cognitive science and biologically inspired hardware and software. He is also active in science outreach through various projects such as cs4fn and Sodarace. Peter was awarded a National Teaching Fellow in 2008 by the Higher Aducation Academy.
Since I was a kid I’ve been fascinated by magic, the way that you can use science and maths to make it look as if you’re breaking the rules of the natural world. Way back I remember being amazed with diagrams in old magic books from my local library showing how the Victorians created ghosts on stage using sheets of glass, or how you could pour a colourless liquid into a glass and it would turn to ‘wine’ or ‘milk’, (all done not with mirrors, but with physics and chemistry). My favourite tricks were the ones where the ‘secret’ was in the hidden maths. With a pack of cards I could entertain my friends and family, being able to perform seemingly impossible feats of mind reading or memory; as a kid that was cool!
Fast forward to the present day; my interest in science and maths led me through various earlier incarnations to being a professor of computer science, researching into biologically inspired artificial intelligence (I also loved Dr Who and Sci Fi on TV, but that’s another story…). Computer science, the study of information and how we process it is, I believe, at the core of understanding the modern world round us. In the past we needed physics chemistry and biology; now we also need computer science. If you look at it, computer science underpins much of the progress in diverse scientific endeavors, for example bioinformatics or climate change, it is also fundamental to our economic prosperity, banking and businesses. It’s computer science that today lets us work, rest and play. But computer science also has a significant ‘image’ problem. The fundamentals are often hidden in our everyday devices, it’s considered to be filled with socially inept ‘geeks’ , it’s seen as too hard or dull, with a low uptake of students at all levels and an almost invisible profile with the public. Why were people not getting it?! It perhaps needed a bit of magic.
With my colleagues Paul Curzon and Jonathan Black I set about applying my knowledge of magic techniques to create a series of entertaining tricks the hidden secrets for which were some fundamental computer science principles. In the same way as those Music Hall illusions from the past had inspired me to study science, we would create tricks to inspire people to explore computing. It wasn’t that hard, in the back of my mind during my scientific career I’d come across techniques that I realised were used in the mathematical based tricks I loved, I just never thought those links would be useful.
One of the first moments of magical ‘fusion’ was with computer assisted tomography, the Radon transform technique which is used to back project and reconstruct 2D images from an angular sequence of 1D scans clicked, it was exactly the same idea that was used to construct forcing matrixes as used by mentalists. The more I looked the more I realised that a whole load of magic tricks involved computer sciency things like binary searches, Markov sequences and so on. These ideas had been developed by magicians, and by scientist separately but they used the same principles. I was intrigued and started to do more research. To my surprise I discovered that there were a number of famous magical effects that had been developed by computer scientists.
Alex Elmsley, who created the wonderful slight of hand move called the Elmsley Count (perfecting which had taken many days of my youth) was actually a Cambridge computer scientist – his famous 16th card trick was a binary search algorithm!
Then I discovered Dr Brent Morris, who has probably the only doctorate in the world in card shuffling with the snappy title of “Permutations by Cutting and Shuffling: A Generalization to Q Dimensions.” Brent was an amateur magician who had practiced long and hard to perfect the Faro (or so called perfect shuffle), where a pack is split in two and weaved together so that the cards interlock alternatively one by one with each other. It’s inspiring to see (I’m still practicing!). The Faro shuffle was known by magicians of old as being a way to shift a card from one position in the pack to another while looking like you’re shuffling the deck. Brent spotted that if you understood the maths of how to move things around you could equally apply the method to efficiently moving data in a computer memory instead of sneakily shifting cards. It got him his computer science doctorate and also two U.S. patents on computers designed with shuffles. I was impressed!
So with all of these fascinating stories of amazing people and equally amazing secrets, we set about writing our first Magic of Computer Science book, hoping that it would catch the imagination, and it did. We traveled the UK doing magic shows, entertaining and educating. The books was translated into Welsh, Italian and German, so we wrote another.
This time we used it to make the point that good software needs both a good mathematical algorithm but also an understanding of how human brains work. This is the all important software usability agenda and it linked with some lovely magic. Magicians for centuries have known how to confuse their audience – its called misdirection – they point left and do something sneaky on the right. Magicians deliberately get you to make mistakes. Understanding how that happens means that you can reverse the procedure and build better software for use in safety critical situations like hospitals, so that the users are directed to pay attention to what’s important.
You would expect that strange out-of-this-world type things happen in magic, and they do! We ended up helping private space explorer and computer games designer Richard Garriott design science based magic tricks to perform on his 2008 visit to the International Space Station (yet another scientist who loves magic). The magic is working.
Finally a blog on magic wouldn’t be complete without a trick…
Shuffle a deck of cards. Spread the cards on the table face down. Now think of the colour RED and select any 8 cards, then think of the colour BLACK and select another 7 cards at random. Now think of RED again, select another 6 random cards, then finally BLACK again and select 5 cards. Shuffle the cards you chose, and then turn the pile face-up. Take the remaining cards, shuffle them and spread them face-down. Now the magic starts. Concentrate. You are going to separate the cards you selected (and that are now in your face-up pile) into two piles, a RED pile and a BLACK pile.
Go through your face-up cards one at a time. If the card is RED put it in the RED pile. For each RED card you put in your RED pile think RED and select a random card from the face-down cards on the table. Put this card face-down in front of your RED pile. Similarly if the next card is a BLACK card put it face up on your BLACK pile, think BLACK and select a random face down cardand put this face-down card in front of your BLACK pile. Go at it until you run out of face-up cards.
You now have a RED pile and in front of that a pile containing the face-down cards you selected while thinking RED. You also have a BLACK pile in front of which is a pile of cards you selected while thinking BLACK.
Interestingly your thoughts have influenced you choice of random cards! Don’t believe me? Look at the pile of cards you chose and put in front of your RED pile. Count the number of RED cards in this pile. Now look at the cards in front of your BLACK pile, and count the number of BLACK cards you selected. They are the same! You selected the same number of RED and BLACK cards totally at random! Amazing.
And for our next trick, wait and see…