Amaze your family and friends this holiday showing your mathematical prowess by generating instant magic squares at will. In the previous article we saw how to generate 4×4 magic squares. If that was a bit too hard, here is a simpler version for generating instant 3×3 magic squares. Learn the trick and some computer science about algorithms and how they prove they always work.
The Trick
First ask an audience member to pick a number out of a hat. That will be the target number. You then write out a magic square that adds to that number.
The Secret
Building this type of magic square is based on the algorithm below that creates magic squares from 9 consecutive numbers. The secret is first to make sure all the numbers you put in the hat are multiples of 3 (i.e. are in the 3 times table). You then follow the algorithm below that tells you what numbers to put where in the grid.
The Magical Algorithm
Place lots of numbers on folded pieces of paper in a hat. All are multiples of 3 (but the audience do not know that).
Ask an audience member to pull one out at random.
Announce that that number is the TARGET number. You will create a magic square that adds up to that number so that is the number that the square rows and so on will add to.
In your head divide that number by 3. For example, if TARGET was 15 THEN you divide 15 by 3 to get 5. Let’s call this value MID, to allow us to be general when we follow the rest of the instructions.
On a 3 by 3 grid, put MID in the centre square (so in our example, put 5 in the middle).
Place the number (MID + 3) in the upper right-hand square (in our example, 5+3 = 8).
Place the number (MID – 3) in the lower left-hand square (in our example, 5-3 = 2).
Place the number (MID + 1) in the upper left-hand square (in our example, 5+1 = 6).
Place the number (MID – 1) in the lower right-hand square (in our example, 5-1 = 4).
Fill in the remaining squares to make the magic square work, so that the rows and columns add to TARGET (subtracting the other two numbers from TARGET in each case to get the missing one).
Image by CS4FN
For the last step, you just need to fill in the empty squares, to make sure the rows and columns add to the right number, TARGET. To do this you just need to keep in mind the target magic number you calculated. (For our example, remember it was 15). It’s a bit of simple arithmetic to find these final numbers and voila, you have built a magic square that adds up to a total picked at random..
Practice doing the maths in your head so that you can make it seem magical.
Does it always work?
You can actually prove the trick always works using some simple algebra based on the template magic square above. See if you can work out how yourself. Using MID and TARGET in place of numbers, for the trick to always generate a correct magic square you need to check that all rows and columns simplify to be equivalent to TARGET. Visit our Conjuring with Computation website to see the detail of how.
Proving a magic trick in this way is just the same thing computer scientists do when they invent new computing algorithms to make sure they work. It increases the assurance that the algorithm and so programs implementing it do work.
If you can program, then you could write a program to generate magic squares using the above algorithm, and then your proof would be a step in verifying your program, as long as it does correctly implement the algorithm!
Computer-generated voices are encountered all the time now in everyday life, not only in automated call centres, but also in satellite navigation systems and home appliances.
Although synthetic speech is now far better, early systems were not as easy to understand as human speech, and many people don’t like synthetic speech at all. Maria Klara Wolters of Edinburgh University decided to find out why. In particular, she wanted to discover what makes synthetic speech difficult for older people to understand, so that the next generation of talking computers would speak more clearly.
She asked a range of people to try out a state-of-the-art speech synthesis system fo the time, tested their hearing and asked their thoughts about the voices. She found that older people have more difficulty understanding computer-generated voices, even if they were assessed as having healthy hearing. She also discovered that messages about times and people were well understood, but young and old alike struggled with complicated words, such as the names of medications, when pronounced by a computer.
More surprisingly, she found that the ability of her volunteers to remember speech correctly didn’t depend so much on their memory, but on their ability to hear particular frequencies (between 1 and 3 kHz). These frequencies are in the lower part of the middle range of frequencies that the ear can hear. They contain a large amount of information about the identity of speech sounds. Another result of the experiments was that the processing of sounds by the brain, so called ‘central auditory processing’ appeared to play a more important role for understanding natural speech, while peripheral auditory processing (processing of sounds in the ear) appeared to be more important for synthetic speech.
As a result of the experiments, Maria drew up a list of design guidelines for the next generation of talking computers: make pauses around important words, slow down, and change to simpler forms of expressions (e.g. “the blue pill” is much easier to understand and remember than a complicated medical name). She suggested that, such simple changes to the robot voices could make an immense difference to the lives of many older people. They also make services that use computer-generated voices easier for everyone to use. This kind of inclusive design benefits everybody, as it allows people from all walks of life to use the same technology. Maybe Maria’s rules would work for people you know too. Try them out next time grandpa asks you to repeat what you just said!
Computer Scientists and digital artists are behind the fabulous special effects and computer generated imagery we see in today’s movies, but for a bit of fun, in this series, we look at how movie plots could change if they involved Computer Science or Computer Scientists. Here we look at an alternative version of the Charles Dickens’ A Christmas Carol (take your pick of which version…my favourites are The Muppet Christmas Carol, but also if we include Theatre, the one man version of Patrick Stewart, in the 1990s and London in 2005 where he plays all 40 or so parts on a bare stage).
**** SPOILER ALERT ****
Ebenezer Scrooge runs a massively successful Artificial Intelligence company called Scrooge and Marley. Their main product is SAM, an AI agent which is close to General AI in capability. The company sells it to the world with both business versions and personal ones. The latter acts as everyone’s friend, confidant, personal trainer, tutor and mentor, and more. It hears everything they hear and say, and sees everything they see. As a result Scrooge is now a Trillionnaire.
Apart from one last employee, Bob Cratchit, everyone in his company has long been replaced by AI agents designed by Scrooge. It is a simple way to boost profits: human employees, after all, are expensive luxuries. First all the clerical staff went, then accounts and Human Resources. The cleaners were replaced by robots that stalk the corridors at night, also acting as security guards, the receptionist is now a robot head. Eventually even the software engineers were replaced by software agents that now beaver away at the code, constantly upgrading, SAM, following SAM’s instructions. Bob Cratchit, maintains both Scrooge’s personal and company IT systems, there for when some human intervention is needed, though that now actually means doing very little but monitoring everything…long hours staring at a screen. He is paid virtually nothing as a result, as he has had his pay repeatedly cut as his duties were replaced. He has had no option to accept the cuts as jobs are scarce and he has a disabled child, Tiny Tim, to support. He is constantly told by Scrooge that he will soon be completely replaced by an agent though, and lives in fear of that day.
On Christmas Eve Scrooge rejects his nephew, Fred’s invitation to visit for Christmas dinner. Instead Scrooge returns, in his self-driving car, to his smart home within his compound on a cliff top overlooking the sea. He lives there alone, given his servants were dismissed long ago. As he arrives, he is shocked to see a vision of his late partner, Jacob Marley, dead for 7 years, in the lens of his smart door cam. The door opens automatically on sensing his arrival, and the vision disappears as he rushes past. He brushes it off as tiredness. Perhaps he is coming down with something. He eats an AI chef designed ready meal made by his smart fridge with integrated microwave. It knew he was arriving so had it ready for him as he entered the kitchen. The house also dispenses him drugs to protect against the possible nascent illness. His house is dark and silent and he is alone, but he likes it that way. He retires to his bedroom, his giant 4-poster bed surrounded by plate glass sides that automatically darken as he climbs in to bed and he quickly falls asleep.
Suddenly, he is woken by a strange clanking. The ghost of Jacob Marley appears and warns him that his race to become a trillionaire has left him with everlasting chains that he will drag to eternity, just as Marley must do. He is warned that he will be visited by three ghosts of past, present and future and he should heed their warnings! There is still time to cast off his chains before it is too late.
The ghost of Christmas Past arrives first and takes him back to his childhood. He sees himself growing up, a loner at boarding school, spending all his time coding, on his laptop, making no friends and wanting none. But, then they move forward in time to his first job as an apprentice software engineer where he meets Belle. For the first time in his life he falls in love and becomes a new person. He starts to love life. She is the joy of his whole existence. He still works hard but he also spends lots of time with Belle. Eventually they become engaged, but soon he is working on making his first million. Gradually, he spends more and more time at work and less time with Belle, as if he doesn’t he will end up behind the curve. He skips social events working late on software upgrades, leaving Belle to go to the theatre, to parties, to dances alone. He sees her less and less as he just doesn’t have the time if he is to make his company successful. He has no time for anything but work. He makes his first fortune running an online betting company, and becomes hardened to the problems of others. He can’t care about the people whose homes are broken up through gambling addiction caused by his site. He has to turn a blind eye to the people he left destitute all because they were drawn in by his company’s use of intentionally addictive computer algorithms. The debt collectors deal with them. It is not his problem that his users are driven to suicide, as there are always more, who can be persuaded to start gambling younger and younger – it is their choice after all. He makes his million and uses the money to invest in a start up AI company that with business partner, Jacob Marley, they take control of, sacking the original founders. Now he is chasing his first billion.
Eventually, Belle realises he has become a stranger to her. Worse, he does not care about the cost of the things he does to others. All the kindness that had blossomed when he first met her has gone. He clearly loves the pursuit of money and personal success far more than he loves her, Winning the race to market is all that matters. Her heart broken, another casualty of his quest for success, Belle releases him from their engagement.
Later, the ghost of Christmas Present arrives and shows Scrooge Christmas as it is now. They see lots of examples of people enjoying life, whatever their circumstances because of the way they value each other, not because they value money or abstract success. Scrooge is shown how Christmas brings joy to all who let the spirit of Christmas enter their hearts. It pulls people together, making them happy, enjoying each other’s company. However, Scrooge also sees how he is perceived by those who know him: a sad monster who cares only for himself and not at all for others, with his own life the worse for it, despite his fabulous wealth. He is shown too how his nephew Fred refuses to give up on him and says he will invite him to join their Christmas every year even if he knows the invitation will always be turned down.
The ghost of Christmas Future arrives next and shows him the future of Bob Cratchit’s family. With little income to look after him, the disabled Tiny Tim dies. Scrooge is also shown his own grave and the aftermath of his lonely death, when he is mocked, even by his own robot agents. On his death, a hacker group takes them over to steal his fortune. Scrooge asks whether this future is the future that will be, or a future that may be only. Assured that he can still change his future, he wakes on Christmas morning.
Staring out the window at the snow falling on Christmas morning, he immediately instructs his AI agent, SAM, to buy the leading cryogenics firm. It freezes rich people when they die, putting them on ice so that one day, once the science is perfected, they can be brought back to life. He instructs other AI agents to research and perfect the science of resurrection. However, he also boosts his cyber security and sacks Cratchit, as clearly he is a security weakness, Scrooge has no evidence, but he strongly suspects the shenanigans in the night must have been Cratchit’s doing, somehow controlling the holographic displays of his smart house, perhaps, or adding hallucinogenics to his food.
Satisfied he gets on with his life as before, building his company, building his wealth.
However, the following year on Christmas Eve he is in a freak accident. His smart car is barrelled into by a self-driving lorry that runs a red light. His AI agents take over immediately and he is cryogenically frozen, the frozen body moved back to his smart home under the control of SAM.
Many decades pass. Then one day his AI agents resurrect him. They have been working on his behalf, perfecting the science of resurrection on the people frozen before him. There are many failures, during which all the company’s former clients, who had paid to be frozen, but who are now just assets of the company, are killed for ever in resurrection experiments. However, SAM finally works out how to resurrect a person successfully. After testing the process on quantum simulations for many years, SAM finally brings Scrooge back to life.
His first thought is for the state of his companies, the state of his wealth .However, he is told that his former money is now worthless. He is told by SAM of the anarchy and the riots of the mid 21st century as people were thrown out of work, replaced by machines, as millions were made homeless, how there were wars over water, over food, and because of environmental destruction made worse by all the conflict. The world economy collapsed completely as a small number of companies amassed all the wealth, but impoverished everyone else, so that there was eventually no one with money to buy their products. Famine and plague followed, sweeping the globe.
However, Scrooge is assured by SAM that it is all ok, because as humanity died out he was protected by his AI agents. They used his money to expand his estate. They bought companies (run by machines) that then worked solely to protect his interests and his personal future. They stockpiled resources, buying automated manufacturing plants along with their whole supply chains, long before money became worthless. They computed the resources he would need, and so did what was needed to secure his future. However, the planet is now dead. Gradually, he realises that he is the last person still known to be alive. Finally, he has his wish: “If they would rather die…they had better do it, and decrease the surplus population.”
Paul Curzon, Queen Mary University of London
The reality
“Everyone is working all the time…Even the folks who are very wealthy now…all they do is work….No one’s taking a holiday. People don’t have time … for the people they love.”
– Guardian. 1 Dec 2025
“The inside story of the race to build the ultimate in Artificial Intelligence”
When the construction of Norman Jackson Children’s Centre in London started, the local council commissioned artists to design a sensory garden full of wonderful sights and sounds so the 3 to 5 year old children using the centre could have fun playing there. Sand pit, water feature, metal tree and willow pods all seemed pretty easy to install and wouldn’t take much looking after, but what about sound? How do you bring interesting sound to an outdoor space and make it fun for young children? Nela Brown from Queen Mary was given the job.
After thinking about the problem for a while she came up with an idea for an interactive sound installation. She wanted to entertain any children visiting the centre, but she especially wanted it to benefit children with poor language skills. She wanted it to be informal but have educational and social value, even though it was outside.
You name it, they press it!
Somewhere around the age of 18 months, children become fascinated with pressing buttons. Toys, TV remotes, light switches, phones, you name it they want to press it. Given the chance to press all the buttons at the same time in quick succession, that is exactly what young children will do. They will also get bored pretty quickly and move on to something else if their toy just makes lots of noise with little variety or interest.
Nela had to use her experience and understanding of the way children play and learn to work out a suitable ‘user interface’ for the installation. That is she had to design how the children would interact with it and be able to experience the effects. The user interface had to look interesting enough to get the attention of the children playing in the garden in the first place. It also obviously had to be easy to use. Nela watched children playing as part of her preparation to design the installation both to get ideas and get a feel for how they learn and play.
Sit on it!
She decided to use a panel with buttons that triggered sounds built into a seat. One important way to make any gadget easier to use is for it to give ‘real-time feedback’. That is, it should do something like play sound or change colour as soon as you press any button, so you know immediately that the button press did do something. To achieve this and make them even more interesting her buttons would both change colour and play sound when they were pressed. She also decided the panel would need to be programmed so children wouldn’t do what they usually do: press all of the buttons at once, get bored and walk away.
Nela recorded traditional stories, poems and nursery rhymes with parents and children from the local area, and composed music to fit around the stories. She also researched different online sound libraries to find interesting sound effects and soundscapes. Of the three buttons, one played the soundscapes, another played the sound effects and the last played a mixture of stories, poems and nursery rhymes. Nela hoped the variety would make it all more interesting for the children so keep their attention longer and by including stories and nursery rhymes she would be helping with language skills.
Can we build it?
Coming up with the ideas was only part of the problem. It then had to be built. It had to be weatherproof, vandal-proof and allow easy access to any parts that might need replacing. As the installation had to avoid disturbing people in the rest of the garden, furniture designer Joe Mellows made two enclosed seats out of cedar wood cladding each big enough for two children, which could house the installation and keep the sound where only the children playing with it would hear it. A speaker was built into the ceiling and two control panels made of aluminium were built into the side. The bottom panel had a special sensor, which could ‘sense’ when a child was sitting in (or standing on) the seat. It was an ultrasonic range finder – a bit like bat-senses using echoes from high frequency sounds humans can’t hear to work out where objects are. The sensor had to be covered with stainless steel mesh, so the children couldn’t poke their fingers through it and injure themselves or break the sensor. The top panel had three buttons that changed colour and played sound files when pressed.
Interaction designer Gabriel Scapusio did the wiring and the programming. Data from the sensors and buttons was sent via a cable, along with speaker cables, through a pipe underground to a computer and amplifier housed in the Children’s Centre. The computer controlling the music and colour changes was programmed using a special interactive visual programming environment for music, audio, and media called Max/MSP that has been in use for years by a wide range of people: performers, composers, artists, scientists, teachers, and students.
The panels in each seat were connected to an open-source electronics prototyping platform by Arduino. It’s intended for artists, designers, hobbyists, and anyone interested in creating interactive objects or environments, so is based on flexible, easy-to-use hardware and software.
The next job was to make sure it really did work as planned. The volume from the speakers was tested and adjusted according to the approximate head position of young children so it was audible enough for comfortable listening without interfering with the children playing in the rest of the garden. Finally it was crunch time. Would the children actually like it and play with it?
The sensory garden did make a difference – the children had lots of fun playing in it and within a few days of the opening one boy with poor language skills was not just seen playing with the installation but listening to lots of stories he wouldn’t otherwise have heard. Nela’s installation has lots of potential to help children like this by provoking and then rewarding their curiosity with something interesting that also has a useful purpose. It is a great example of how, by combining creative and technical skills, projects like these can really make a difference to a child’s life.
Computer Scientists and digital artists are behind the fabulous special effects and computer generated imagery we see in today’s movies, but for a bit of fun, in this series, we look at how movie plots could change if they involved Computer Scientists. Here we look at an alternative version of the Christmas film, Elf, starring Will Ferrell.
***Spoiler Alert***
Christmas Eve, and a baby crawls into Santa’s pack as he delivers presents at an orphenage. The baby is wearing only a nappy, but this being the 21st century the babys’s reusable Buddy nappy is an Intelligent nappy. It is part of the Internet of Things and is chipped, including sensors and a messaging system that allow it to report to the laundry system when the nappy needs changing (and when it doesn’t) as well as performing remote health monitoring of the baby. It is the height of optimised baby care. When the baby is reported missing the New York Police work with the nappy company, accessing their logs, and eventually work out which nappy the baby was wearing and track its movements…to the roof of the orphenage!
The baby by this point has been found by Santa in his sack at the North Pole, and named Buddy by the Elves after the label on his nappy. The Elves change Buddy’s nappy, and as their laundry uses the same high tech system for their own clothes, their laundry logs the presence of the nappy, allowing the Police to determine its location.
Santa intends to officially adopt Buddy, but things are moving rapidly now. The New York Police believe they have discovered the secret base of an international child smuggling ring. They have determined the location of the criminal hideout as somewhere near the North Pole and put together an armed task force. It is Boxing Day. As Santa gets in touch with the orphanage to explain the situation, and arrange an adoption, armed police already surround the North Pole and are moving in.
The New York Police Commissioner, wanting the good publicity she sees arising from capturing a child smuggling ring, orders the operation to be live streamed to the world. The precise location of the criminal hideout, so operation, is not revealed to the public, which is fortunate given what follows. As the police move in the cameras are switched on and people the world over, are glued to their screens watching the operation unfold. As the police break in to the workshops, toys go flying and Elves scatter, running for their lives, but as Santa appears and calmly allows himself to be handcuffed, it starts to dawn on the police where they are and who they have arrested. The live stream is cut abruptly, and as the full story emerges, and apologies made on all sides. Santa is proved to be real to a world that was becoming sceptical. A side effect is there is a massive boost in Christmas Spirit across the world that keeps Santa’s sleigh powered without the need for engines for many decades to come. Buddy is officially adopted and grows up believing he is an Elf until one fateful year when …
In reality
The idea of the Internet of Things is that objects, not just people, have a presence on the Internet and can communicate with other objects and systems. The idea provides the backbone of the idea of smart homes, where fridges can detect they are out of milk and order more, carpets detect dirt and summon a robot hoover, and the boiler detects when the occupants are nearing home and heats the house just in time.
Wearable computing, where clothes have embedded sensors and computers is also already a reality, though mainly in the form of watches, jewellery and the like. Clothes in shops do include electronic tags that help with stock control, and increasingly electronic-textiles based on metallic fibres and semi-conducting inks, are being used to create clothes with computers and electronics embedded in them.
Making e-textiles durable to be washed is still a challenge. Smart reusable nappies may be a while in coming.
Tony Stockman, who was blind from birth, was a Senior Lecturer at QMUL until his retirement. A leading academic in the field of sonification of data, turning data into sound, he eventually became the President of the “International Community for Auditory Display”: the community of researchers working in this area.
Traditionally, we put a lot of effort into finding the best ways to visualise data so that people can easily see the patterns in it. This is an idea that Florence Nightingale, of lady of the lamp fame, pioneered with Crimean War data about why soldiers were dying. Data visualisation is considered so important it is taught in primary schools where we all learn about pie charts and histograms and the like. You can make a career out of data visualisation, working in the media creating visualisations for news programmes and newspapers, for example, and finding a good visualisation is massively important working as a researcher to help people understand your results. In Big Data a good visualisation can help you gain new insights into what is really happening in your data. Those who can come up with good visualisations can become stars, because they can make such a difference (like Florence Nightingale, in fact)
Many people of course, Tony included cannot see, or are partially sighted, so visualisation is not much help! Tony therefore worked on sonifying data instead, exploring how you can map data onto sounds rather than imagery in a way that does the same thing.: makes the patterns obvious and understandable.
His work in this area started with his PhD where he was exploring how breathing affects changes in heart rate. He first needed a way to both check for noise in the recording and then also a way to present the results so that he could analyse and so understand them. So he invented a simple way to turn data into sound using for example frequencies in the data to be sound frequencies. By listening he could find places in his data where interesting things were happening and then investigate the actual numbers. He did this out of necessity just to make it possible to do research but decades later discovered there was by then a whole research community by then working on uses of and good ways to do sonification,
He went on to explore how sonification could be used to give overviews of data for both sighted and non-sighted people. We are very good at spotting patterns in sound – that is all music is after all – and abnormalities from a pattern in sound can stand out even more than when visualised.
Another area of his sonification research involved developing auditory interfaces, for example to allow people to hear diagrams. One of the most famous, successful data visualisations was the London Tube Map designed by Harry Beck who is now famous as a result because of the way that it made the tube map so easy to understand using abstract nodes and lines that ignored distances. Tony’s team explored ways to present similar node and line diagrams, what computer scientist’s call graphs. After all it is all well and good having screen readers to read text but its not a lot of good if all it tells you reading the ALT text that you have the Tube Map in front of you. And this kind of graph is used in all sorts of every day situations but are especially important if you want to get around on public transport.
There is still a lot more to be done before media that involves imagery as well as text is fully accessible, but Tony showed that it is definitely possible to do better, He also showed throughout his career that being blind did not have to hold him back from being an outstanding computer scientists as well as a leading researcher, even if he did have to innovate himself from the start to make it possible.
How reliant on machines should we let ourself become? E.M. Forster is most famous for period dramas but he also wrote a brilliant Science Fiction short story, ‘The Machine Stops’ about it. It is a story I first read in an English Literature lesson at school, a story that convinced me that English Literature could be really, really interesting!
Written in 1909 decades before the first computers were built never mind the internet, video calls, digital music and streaming, he wrote of a future with all of that, where humans live alone in identical underground rooms across the Earth, never leaving because there is no reason to leave, never meeting others because they can meet each other through the Machine. Everything is at hand at the touch of a button. Everything is provided by the Machine, whether food, water, light, entertainment, education, communication, and even air, …
The story covers themes of whether we should let ourself become disconnected from the physical world or not. Is part of what makes us human our embodiment in that world. He refers to this as “the sin against the body” a theme returned to in the film WALL-E. Disconnected from the world humans decline not only in body but also in spirit.
As the title suggests, the story also explores the problems of becoming over-reliant on technology and of what then happens if the technology is taken away. It is more than this though but the issue of repeatedly accepting “good enough” as a replacement for the fidelity of physical and natural reality. What seems wonderfully novel and cool, convenient or just cheaper may not actually be as good as the original. Human-human interaction that is face-to-face is far richer than we get through a video call, for example, and yet meetings have disappeared rapidly in favour of the latter in the 21st century.
Once we do become reliant on machines to service our every whim, what would happen if those ever more connected machines break? Written over a century ago, this is very topical now, of course, as, with our ever increasing reliance on inter-connected digital technology for energy, communication, transport, banking and more, we have started to see outages happen. These have arisen from the consequences of bugs and cyber attacks, from ‘human error’ and technology that it turns out is just not quite dependable enough, leading to country and world-wide outages of the things that constitutes modern living.
How we use technology is up to us all of course, and like magpies we love shiny new toys, but losing all the skills and understanding just because they can be now done by the machine may not be very wise in the long term. More generally, we need to make sure the technology we do make ourselves reliant on, is really, really dependable: far more dependable than our current standards are in actual practice. That needs money and time, not rushed introductions, but also more Computer Science research on how to do dependability better in practice. Above all we need to make sure we do continue to understand the systems we build well enough to maintain them in the long term.
Any one claiming to be a hard-core Computer Scientist would be ashamed if they had to admit they hadn’t read Terry Pratchett. If you are and you haven’t, then ‘Going Postal’ is a good place to start.
‘Going Postal’, is a must for anyone interested in networks. Not because it has any bearing on reality. It doesn’t. It’s about Discworld, a flat world that is held up on the back of elephants, and where magic reigns. Technology is starting to get a foothold though. For example, cameras, computers and movies have all been invented…though they usually have an Elf inside. Take cameras: they work because the Elf has a paint box and an easel. Take too many sunsets and he’ll run out of pink! It is all incredibly silly…but it works and so does the technology.
Now telecommunications technology is gaining a foothold…Corrupt business is muscling in and the post office is struggling to survive. Who would want to send a letter when they can send a c-mail over the Clacks? The Clacks are a network of semaphore towers that allow messages to ‘travel at the speed of light’.
At each tower the operators
“pound keys, kick pedals and pull levers as fast as they can'”
to forward the message to the next tower in the network and so on to their destination. The clacks are so fashionable, people have even started carrying pocket semaphore flags everywhere they go, so they can send messages to people on the other side of the room.
“But can you write S.W.A.L.K. on a clacks? Can you seal it with a loving kiss? Can you cry tears on to a clacks, can you smell it, can you enclose a pressed flower? A letter is more than just a message.”
Moist von Lipwig, a brilliant con-artist who just did one con too many, is given the job of saving the Post-office…his choice was ‘Take the job or die’. Not, actually, such a good deal given the last few Postmasters all died on the job … in the space of a few weeks.
Will he save the post office, or is the march of technology unstoppable?…and just who are the ‘Smoking GNU’ that you hear whispers about on the Clacks?
Reading this book has got to be the most fun way imaginable of learning about telecom networks, not to mention entrepreneurship and the effect of computers on society. None of the actual technology is the same as in our world of course, but the principle is the same: transmission codes, data and control signals, simplex and duplex transmissions, image encoding, internet nodes, encryption, e-commerce, phreakers and more…they are all there, which just goes to show computer science is not just about our current computer technology. It all applies even when there is no silicon in sight.
Oh, and this is the 33rd Discworld novel, so if you do get hooked, don’t expect to get much more done for the next few weeks as you catch up.
How to spot a bad chef when you’ve never tasted the food (OR How to spot a bad quantum simulator when you do not know what the quantum circuit it is simulating is supposed to do.)
Imagine you’re a judge on a wild cooking competition. The contestants are two of the best chefs in the world, Chef Qiskit and Chef Cirq. Today’s challenge is a strange one. You hand them both a mysterious, ancient cookbook found in a crashed spaceship. The recipe you’ve chosen is called “Glorp Soup”. The instructions are very precise and scientific: “… Heat pan to 451 degrees. Stir counter-clockwise for exactly 18.7 seconds. … Add exactly 3 grams of powdered meteorite (with the specified composition). …” The recipe is a perfectly clear algorithm, but since no human has ever made Glorp Soup, nobody knows what it’s supposed to taste, look, or smell like. Both chefs go to their identical kitchens with the exact same alien ingredients. After an hour, they present their dishes.
Chef Qiskit brings out a bowl of thick, bubbling, bright purple soup that smells like cinnamon.
Chef Cirq brings out a bowl of thin, clear, green soup that smells like lemons.
Now you have a fascinating situation. You have no idea which one is the “real” Glorp Soup. Maybe it’s supposed to be purple, or maybe it’s green. But you have just learned something incredibly important: at least one of your expert chefs made a mistake. They were given the exact same, precise recipe, but they produced two completely different results. You’ve found a flaw in one of their processes without ever knowing the correct answer.
This powerful idea is called Differential Testing.
Cooking with Quantum Rules
In our research, the “alien recipes” we use are called quantum circuits. These are the step-by-step instructions for a quantum computer. And the “chefs” are incredibly complex computer programs called quantum simulators, built by places like Google and IBM.
Scientists give these simulators a recipe (a circuit) to predict what a real quantum computer will cook up. These “dishes” could be the design for a new medicine or a new type of battery. If the simulator-chef gets the recipe wrong, the final result could be useless or even dangerous. But how do you check a chef’s work when the recipe is for a food you’ve never tasted? How do you test a quantum simulator when you do not know exactly what a quantum circuit should do.
FuzzQ: The Robot Quantum Food Critic
We can’t just try one recipe, one quantum circuit. We need to try thousands. So we built a robot “quantum food critic”, a program we call FuzzQ. FuzzQ’s job is to invent new “alien recipes” ie quantum circuits and see if the two “chefs” cook the same dish (i.e. different simulators do the same thing when simulating it). This process of trying out thousands of different, and sometimes very weird, recipes is called Fuzzing.
Here’s how our quantum circuit food critic works:
It writes a recipe: FuzzQ uses a rulebook for “alien cooking” to invent a new, unique, and often very strange quantum circuit.
It gives the recipe to both chefs: It sends the exact same quantum circuit to “Chef Qiskit” (the Qiskit simulator) and “Chef Cirq” (the Cirq simulator).
It tastes the soup: FuzzQ looks at the final result from both. If they’re identical, it assumes they’re correct. But if they do different things, so one did the equivalent of make a purple, bubbling soup and the other made the equivalent of a clear, green soup, FuzzQ sounds the alarm. It has found a bug!
We had FuzzQ invent and “taste-test”, so check the results of, over 800,000 different quantum recipes.
The Tale of the Two Ovens
Our robot critic found 8 major types of quantum “cooking” errors. One of the most interesting was for a simple instruction called a “SWAP”, which was discovered by looking at how the two chefs used their high-tech “ovens”.
Imagine both chefs have an identical oven with two compartments, a Top Oven and a Bottom Oven. They preheat them according to the recipe: the Top Oven to a very hot 250°C, and the Bottom Oven to a low 100°C. The recipe then has a smart-oven command:
“Logically SWAP the Top Oven and Bottom Oven.”
Both chefs press the button to do the “SWAP”.
Chef Cirq’s ovenworks as expected. It starts the long process of cooling the top oven and heating the bottom one.
Chef Qiskit’s oven, however, is a “smarter” model. It takes a shortcut. It doesn’t change the temperatures at all but just swaps the labels on its digital display so that the one at the top previously labelled the Top Oven is now labelled as the Bottom Oven, and vice versa. The screen now lies, showing Top Oven: 100°C and Bottom Oven: 250°C, even though the physical reality is the opposite: the one at the top is still the incredibly hot, 250°C and the one below it is still 100°C.
The final instruction is:
“Place the delicate soufflé into the physical TOP OVEN.”
Chef Cirq opens his top oven (ie the one positioned above the other and labelled Top Oven), which is now correctly at 100°C, having cooled down, and bakes a perfect soufflé.
Chef Qiskit, trusting his display, opens his top oven (ie the one positioned above the other but internally now labelled Bottom Oven) and puts his soufflé inside. But that physical oven that is at the top is still at 250°C. A few minutes later, he has a burnt, smoky crisp.
Our robot judge, FuzzQ, doesn’t need to know how to bake. It just looks at the two final soufflés. One is perfect, and the other is charcoal. The results are different, so FuzzQ sounds the alarm: “Disagreement found!”
This is how we found the bug. We didn’t need to know the “correct temperature”. We only needed to see that the two expert simulators, when given the same instructions, produced two wildly different outcomes. Knowing something now is amiss, further investigation of what each quantum simulator did with those identical instructions, can determine what actually went wrong and the problematic quantum simulator improved. By finding these disagreements, we’re helping to make sure the amazing tools of quantum science are trustworthy.
Jerry Elliot High Eagle was possibly the first Native American to work in NASA mission control. He worked for NASA for over 40 years, from the Apollo moon landings up until the space shuttle missions. He was a trained physicist with both Cherokee and Osage heritage and played a crucial part in saving the Apollo 13 crew when an explosion meant they might not get back to Earth alive.
The story of Apollo 13 is told in the Tom Hanks film Apollo 13. The aim was to land on the moon for a third time following the previous two successful lunar missions of Apollo 11 and Apollo 12. That plan was aborted on the way there, however, after pilot James Swigert radioed his now famous if misquoted words “Okay, Houston … we’ve had a problem here”. It was a problem that very soon seemed to mean they would die in space: an oxygen tank had just exploded. Instead of being a moon landing the mission turned into the most famous rescue attempt in history – could the crew of James Lovell, Jack Swigert and Fred Haise get back to Earth before their small space craft turned into a frozen, airless and lifeless space coffin.
While the mission control team worked with the crew on how to keep the command and lunar modules habitable for as long as possible (they were rapidly running out of breathable air, water and heat and had lost electircal power), Elliot worked on actually getting the craft back to Earth. He was the “retrofire officer” for the mission which meant he was an expert in, and responsible for, the trajectory Apollo 13 took from the Earth to the moon and back. He had to compute a completely new trajectory from where they now were, which would get them back to Earth as fast and as safely as possible. It looked impossible given the limited time the crew could possibly stay alive. Elliot wasn’t a quitter though and motivated himself by telling himself:
“The Cherokee people had the tenacity to persevere on the Trail of Tears … I have their blood and I can do this.”
The Trail of Tears was the forced removal of Native Americans from their ancestral homelands by the US government in the 19th century to make way for the gold rush . Now we would call this ethnic cleansing and genocide. 60, 000 Native American people were moved with the Cherokee forcibly marched a 1000 miles to an area to the West of the Mississippi, thousands dying along the way.
The best solution for Apollo 13, was to keep going and slingshot round the dark side of the moon, using the forces arising from its gravity, together with strategic use of the boosters to push the space craft on back to Earth more quickly than on those boosters alone. The trajectory he computed had to be absolutely accurate or the crew would not get home and he has suggested the accuracy needed was like “threading a needle from 70 feet away!” Get it wrong and the space craft could miss the Earth completely, or arrive too fast to reenter earth’s orbit and return through the atmosphere.
Jerry Elliot High Eagle, of course, famously got it right: the crew survived, safely returning to Earth and Elliot was awarded the President’s Medal of Freedom, the highest American honour possible, for the role he played. The Native American people also gave him the name High Eagle for his contributions to space exploration.