Nikola Tesla: the invisible genius

by Peter W. McOwan and Paul Curzon, Queen Mary University of London

(From the archive)

Nikola Tesla is an enigma wrapped in a mystery. Not bad going for an electronic engineer. Born, so the stories go, in the middle of a thunderstorm in Serbia, Tesla has left a fascinating legacy to the world today. Magnetism is measured in Tesla, a unit named after him. But it is perhaps one victory we owe most to Tesla for. He fought a battle to show that alternating current (A/C) was superior to direct current (D/C) when it came to transmitting electricity over a distance. His opponent was none other than America’s most respected celebrity inventor, Thomas Edison.

Absolutely shocking behaviour

In the so called Battle of the Currents Tesla and his entrepreneurial partner George Westinghouse eventually won (they had maths on their side). If he hadn’t the world would have been filled with electrical substations at the end of each road, because D/C doesn’t do distance well.

Why is A/C better?

A/C is better for distributing power over a distance because it allows the easy changing of voltages using a transformer. Power is calculated as current times voltage (P = IV). For a given amount of power to be sent, a low voltage requires a higher current. But metal conducting wires have resistance. That means some of that precious power will be lost as heat in the wires. Theory (always important to know the theory) says that power loss is given by P = I²R. So from this its obvious that low-voltage, high-current transmissions will cause a much greater power loss than high-voltage, low-current ones. This fact holds whether D/C or A/C is used. But, and here is the clincher, transforming D/C power from one voltage to another is difficult and expensive. In Tesla’s day it needed a large spinning device called a rotary converter, and moving parts are always a problem. But with A/C these voltage changes can be done with simple and cheap transformer coils with no moving parts and no maintenance. Tesla wins in theory and in practice.

A Dirty Fight

Tesla ultimately won, but the fight was a really dirty one – there was ego and money at stake. Edison got his employees to badmouth A/C, to try and convince the public it was dangerous. They used A/C to execute stray cats and dogs to try to prove to the press that A/C was more dangerous than Edison’s system of D/C. They even filmed the A/C electrocution of Topsy, a circus elephant from Coney Island! Edison’s spin doctors also tried to popularise the term “Westinghoused” (the rival company to Edison’s that Tesla was working with) to mean being electrocuted. The battle cost an astronomical amount, and toward the end Tesla pulled out, tearing up the contract that could have made him the world’s first billionaire, and leaving Westinghouse to capitalise on the final victory.

Tesla retreated, and focussed on wireless control inventing the world’s first remote controlled boat, but he also had another card up his sleeve – he had invented the radio, and had the patent. But success was short lived. After a few years the US courts decided that Guglielmo Marconi was the inventor of radio and Tesla lost out again. In fact in 1909 Marconi was awarded the Nobel Prize for Physics for the invention of radio, and the rumour was that Tesla and Edison’s fight had lost them the chance of being included in the award.

Springing back into action

Never daunted, in 1899, Tesla moved to Colorado Springs, Colorado, where he could have enough room for his high-voltage, high-frequency experiments. He told reporters that he was conducting wireless telegraphy experiments, transmitting signals from a mountain called Pikes Peak in Colorado to Paris. He transmitted extremely low frequencies through the ground as well as between the earth’s surface and the ionosphere, and patented the ideas. He also calculated that the resonant frequency of the Earth was approximately 8 Hertz (Hz). Later in the 1950s, researchers confirmed that the resonant frequency of the Earth’s ionosphere was in this range, but chose to name it the Schumann resonance. Tesla was invisible again.

This is the end?

Tesla suffered from a lot of illness as a child and had a condition where he saw bright flashing lights and had visions and saw flashbacks. He was neurodiverse in that he had an eidetic (ie photographic) memory, able to remember pictures in great detail at a glance. He seems to have had an obsessive personality and may well have been on the autistic spectrum. On the whole he turned these things to his advantage leading to his great achievements: such as turning visions into inspiration for ideas and pushing on with ideas despite all the challenges he encountered through his life.

However, Tesla was no good with money. His genius and lifetime of invention led to him dying alone of heart failure, in a New York hotel room, impoverished at the age of 86. The story goes that the documents he had were seized by the American secret service under the direct orders of J Edgar Hoover. Tesla had been developing his radical ideas about transmitting power without wires through the earth over great distances. He called this a peace ray; it could manifest electrical power in mid-air wherever it was needed on the Earth. He also claimed to have worked out a ‘dynamic theory of gravity’ – even Einstein failed at this – but it was never published.

Tesla’s life has of course been the subject of movies; he most recently appeared in the film ‘The Prestige’, played by David Bowie: who else could play such an enigma.

Tesla is also featured on the bank notes of Serbia. So when you next plug in your mobile phone charger or use wifi, remember Tesla, the invisible genius who made it all possible.

Related Magazines …

EPSRC supports the cs4fn blog through research grants (EP/K040251/2 and EP/K040251/2 held by Professor Ursula Martin as well as grant EP/W033615/1).

Dickens knitting in code

by Paul Curzon, Queen Mary University of London

(From the archive)

Charles Dickens is famous for his novels highlighting Victorian social injustice. Despite what people say, art and science really do mix, and Dickens certainly knew some computer science. In his classic novel about the French Revolution, A Tale of Two Cities, one of his characters relies on some computer science based knitting.

Dickens actually moved in the same social circles as Charles Babbage, the Victorian inventor of the first computer (which he designed but unfortunately never managed to build) and Ada Lovelace the mathematician who worked with him on those first computers. They went to the same dinner parties and Dickens will have seen Babbage demonstrate his prototype machines. An engineer in Dickens novel, Little Dorrit, is even believed to be partly based on Babbage. Dickens was probably the last non-family member to visit Ada before she died. She asked him to read to her, choosing a passage from his book Dombey and Son in which the son, Paul Dombey, dies. Like Ada, Paul Dombey had suffered from illness all his life.

So Charles Dickens had lots of opportunity to learn about algorithms! His novel ‘A Tale of Two Cities’ is all about the French Revolution, but lurking in the shadows is some computer science. One of the characters, a revolutionary called Madame Defarge takes the responsibility of keeping a register of all those people who are to be executed once the revolution comes to pass: the aristocrats and “enemies of the people”. Of course in the actual French Revolution lots of aristocrats were guillotined precisely for being enemies of the new state.

Now Madame Defarge could have just tried to memorize the names on her ‘register’ as she supposedly has a great memory, but the revolutionaries wanted a physical record. That raises the problem, though, of how to keep it secret, and that is where the computer science comes in. Madame Defarge knits all the time and so she decides to store the names in her knitting.

“Knitted, in her own stitches and her own symbols, it will always be as plain to her as the sun. Confide in Madame Defarge. It would be easier for the weakest poltroon that lives, to erase himself from existence, than to erase one letter of his name or crimes from the knitted register of Madame Defarge.”

Computer scientists call this Steganography: hiding information or messages in plain sight, so that no one suspects they are there at all. Modern forms of steganography include hiding messages in the digital representation of pictures and in the silences of a Skype conversation.

Madame Defarge didn’t of course just knit French words in the pattern like a victorian scarf version of a T-shirt message. It wouldn’t have been very secret if anyone looking at the resulting scarf could read the names. So how to do it? In fact, knitting has been used as a form of steganography for real. One way was for a person to take a ball of wool and mark messages down it in Morse Code dots and dashes. The wool was then knitted into a jumper or scarf. The message is hidden! To read it you unpick it all and read the morse code back off the wool.

The names were “Knitted, in her own stitches and her own symbols”

That wouldn’t have worked for Madame Defarge though. She wanted to add the names to the register in plain view of the person as they watched and without them knowing what she was doing. She therefore needed the knitting patterns themselves to hold the code. It was possible because she was both a fast knitter and sat knitting constantly so it raised no suspicion. The names were therefore, as Dickens writes “Knitted, in her own stitches and her own symbols”

She used a ‘cipher’ and that brings in another area of computer science: encryption. A cipher is just an algorithm – a set of rules to follow – that converts symbols in one alphabet (letters) into different symbols. In Madame Defarge’s case the new symbols were not written but knitted sequences of stitches. Only if you know the algorithm, and a secret ‘key’ that was used in the encryption, can you convert the knitted sequences back into the original message.

In fact both steganography and encryption date back thousands of years (computer science predates computers!), though Charles Dickens may have been the first to use knitting to do it in a novel. The Ancient Greeks used steganography. In the most famous case a message was written on a slave’s shaved head. They then let the hair grow back. The Romans knew about cryptographic algorithms too and one of the most famous ciphers is called the Caesar cipher as Julius Caesar used it when writing letters…even in Roman times people were worried about the spies reading their equivalent of emails.

Dickens didn’t actually describe the code that Madame Defarge was using so we can only guess…but why not see that as an opportunity and (if you can knit) why not invent a way yourself. If you can’t knit then learn to knit first and then invent one! Somehow you need a series of stitches to represent each letter of the alphabet. In doing so you are doing algorithmic thinking with knitting. You are knitting your way to being a computer scientist.

Related Magazines …

EPSRC supported this article through research grants (EP/K040251/2 and EP/K040251/2 held by Professor Ursula Martin as well as grant EP/W033615/1).

CS4FN Advent – Day 1 – Woolly jumpers, knitting and coding

Welcome to the first ‘window’ of the CS4FN Christmas Computing Advent Calendar. The picture on the ‘box’ was a woolly jumper with a message in binary, three letters on the jumper itself and another letter split across the arms. Can you work out what it says? (Answer at the end).

Come back tomorrow for the next instalment in our Advent series.

Wrap up warm with our first festive CS4FN article, from Karen Shoop, which is all about the links between knitting patterns and computer code. Find out about regular expressions in her article: Knitters and Coders: separated at birth?

Image credit: Regular Expressions by xkcd

Dickens Knitting in Code – this CS4FN article, by Paul Curzon, is about Charles Dickens’ book A Tale of Two Cities. One of the characters, Madame Defarge, takes coding to the next level by encoding hidden information into her knitting, something known as steganography (basically hiding information in plain sight). We have some more information on the history of steganography and how it is used in computing in this CS4FN article: Hiding in Elizabethan binary.

In Craft, Culture, and Code Shuchi Grover also considers the links between coding and knitting, writing that “few non-programming activities have such a close parallels to coding as knitting/crocheting” (see section 4 in particular, which talks about syntax, decomposition, subroutines, debugging and algorithms).

Something to print and colour in

This is a Christmas-themed thing you might enjoy eating, if you’ve any room left of course. Puzzle solution tomorrow. This was designed by Elaine Huen.

Solving the Christmas jumper code

01011000

01001101

01000001

01010011

What four letters might be being spelled out here? Each binary number represents one letter and you can find out what each letter is by looking at this binary-to-letters translator. Have a go at working out the word using the translator (but the answer is at the end of this post).

Keep scrolling

Bit more

The Christmas jumper says… XMAS

Knitters and Coders: separated at birth?

People often say that computers are all around us, but you could still escape your phone and iPod and go out to the park, far away from the nearest circuit board if you wanted to. It’s a lot more difficult to get away from the clutches of computation itself though. For one thing, you’d have to leave your clothes at home. Queen Mary Electronic Engineer Karen Shoop tells us about the code hidden in knitting, and what might happen when computers learn to read it.

If you’re wearing something knitted look closely at it (if it’s a sunny day then put this article away till it gets colder). Notice how the two sides don’t look the same: some parts look like a raised ‘v’ and others like a wave pattern. These are made by the two knitting stitches: knit and purl. With knit you stick the needle through and then behind the knitting; with purl you stick the needle in the other direction, starting behind the knitting and then pointing at the knitter. Expert knitters know that there’s more to knitting than just these two stitches, but we’ll stick to knit and purl. As these stitches are combined, the wool is transformed from a series of waves or ‘v’s into a range of patterns: stretchy stripes (ribs), raised speckles (moss), knots and ropes (cable). It all depends on the number of purls and knits, how they are placed next to each other and how often things are repeated.

Knitters get very proficient at reading knitting patterns, which are just varying combinations of k (knits) and p (purls). So the simplest pattern of all, knitting a square, would look something like:

’30k (30 knit stitches), finish the line, then repeat this 20 times’.

A rib would look like: ‘5k, 5p, then repeat this [a certain number of times], then repeat the line [another number of times]’

To a computer scientist or electronic engineer all this looks rather like computer code or, to be precise, like the way of describing a pattern as a computer program.

How your jumper is like coding

So look again at your knitted hat/jumper/cardi and follow the pattern, seeing how it changes horizontally and vertically. Just as knitters give instructions for this in their knitting pattern, coders do the same when writing computer programs. Specifically programmers use things called regular expressions. They are just a standard way to describe patterns. For example a regular expression might be used to describe what an email address should look like (specifying rules such as that it has one ‘@’ character in the middle of other characters, no full-stops/periods immediately before the @ and so on), what a phone number looks like (digits/numbers, no letters, possibly brackets or hyphens) and now what a knitting pattern looks like (lots of ks and ps). Regular expressions use a special notation to precisely describe what must be included, what might possibly be included, what cannot be, and how many times things should be repeated. If you were going to teach a computer how to read knitting patterns, a regular expression would be just what you need.

Knitting a regular expression

Let’s look at how to write a knitting pattern as a regular expression. Let’s take moss or seed stitch as our example. It repeats a “knit one purl one” pattern for one line. The next line then repeats a “purl one knit one” pattern, so that every knit stitch has a purl beneath it and vice versa. These two lines are repeated for as long as is necessary. How might we write that both concisely and precisely so there is no room for doubt?

In knitting notation (assuming an even number of stitches) it looks like: Row 1: *k1, p1; rep from * Rows 2: *p1, k1; rep from * or Row 1: (K1, P1) rep to end Row 2: (P1, K1) rep to end Repeat these 2 rows for length desired.

All this is fine … if it’s being read by a human, but to write experimental knitting software the knitting notation we have to use a notation a computer can easily follow: regular expressions fit the bill. Computers do not understand the words we used in our explanation above: words like ‘row’, ‘repeat’, ‘rep’, ‘to’, ‘from’, ‘end’, ‘length’ and ‘desired’, for example. We could either write a program that makes sense of what it all means for the computer, or we could just write knitting patterns for computers in a language they can already do something with: regular expressions. If we wanted to convert from human knitting patterns to regular expressions we would then write a program called a compiler (see Smart translation) that just did the translation.

In a regular expression to give a series of actions we just name them. So kp is the regular expression for one knit stitch followed immediately by one purl. The knitting pattern would then say repeat or rep. In a regular expression we group actions that need to be repeated inside curved brackets, resulting in (kp). To say how many times we need to repeat, curly brackets are used, so kp repeated 10 times looks like this: (kp){10}.

Since the word ‘row’ is not a standard coding word we then use a special character, written, \n, to indicate that a new line (=row) has to start. The full regular expression for the row is then (kp){10}\n. Since the first line was made of kps the following line must be pks, or (pk){10}\n

These two lines have to be repeated a certain number of times themselves, say 20, so they are in turn wrapped up in yet more brackets, producing: ((kp){10}\n(pk){10}\n){20}.

If we want to provide a more general pattern, not fixing the number of kps in a row or the number of rows, the 10 and 20 can be replaced with what are called variables – x and y. They can each stand for any number, so the final regular expression is:

((kp){x}\n(pk){x}\n){y}

How would you describe a rib as a regular expression (remember, that’s the pattern that looks like stretchy stripes)? The regular expression would be ((kp){x}\n){y}.

Regular expressions end up saying exactly the same thing as the standard knitting patterns, but more precisely so that they cannot be misunderstood. Describing knitting patterns in computer code is only the start, though. We can use this to write code that makes new patterns, to find established ones or to alter patterns, like you’d need to do if you were using thicker wool, for example. An undergraduate student at Queen Mary, Hailun Li, who likes knitting, used her knowledge to write an experimental knitting application that lets users enter their own combination of ps and ks and find out what their pattern looks like. She took her hobby and saw how it related to computing.

Look at your woolly jumper again…it’s full of computation!

– Karen Shoop, Queen Mary University of London, Summer 2014