Music-making mates for Mortimer

Image of Mortimer provided by Louis McCallum for this article

Robots are cool. Fact. But can they keep you interested for more than a short time? Over months? Years even? Louis McCallum of Queen Mary University of London tells us about his research using Mortimer a drumming robot.

Roboticists (thats what we’re called) have found it hard to keep humans engaged with robots once the novelty wears off. They’re either too simple and boring, or promise too much and disappoint. So, at Queen Mary University of London we’ve built a robot called Mortimer that can not only play the drums, but also listen to humans play the piano and jam along. He can talk (a bit) and smile too. We hope people will build long term relationships with him through the power of music.

Robots have been part of our lives for a long time, but we rarely see them. They’ve been building our cars and assembling circuit boards in factories, not dealing with humans directly. Designing robots to have social interactions is a completely different challenge that involves engineering and artificial intelligence, but also psychology and cognitive science. Should a robot be polite? How long and accurate should a robot’s memory be? What type of voice should it have and how near should it get to you?

It turns out that making a robot interact like a human is tricky, even the slightest errors make people feel weird. Just getting a robot to speak naturally and understand what we’re saying is far from easy. And if we could, would we get bored of them asking the same questions every day? Would we believe their concern if they asked how we were feeling?

Would we believe their concern
if they asked how we were feeling?

Music is emotionally engaging but in a way that doesn’t seem fake or forced. It also changes constantly as we learn new skills and try new ideas. Although there have been many examples of family bands, duetting couples, and band members who were definitely not friends, we think there are lots of similarities between our relationships with people we play music with and ‘voluntary non-kin social relationships’ (as robotocists call them – ‘friendships’ to most people!). In fact, we have found that people get the same confidence boosting reassurance and guidance from friends as they do from people they play music with.

So, even if we are engaged with a machine, is it enough? People might spend lots of time playing with a guitar or drum machine but is this a social relationship? We tested whether people would treat Mortimer differently if it was presented as a robot you could socially interact with or simply as a clever music machine. We found people played for longer uninterrupted and stopped the robot whilst it was playing less often if they thought you could socially interact with it. They also spent more time looking at the robot when not playing and less time looking at the piano when playing. We think this shows they were not only engaged with playing music together but also treating him in a social manner, rather than just as a machine. In fact, just because he had a face, people talked to Mortimer even though they’d been told he couldn’t hear or understand them!

So, if you want to start a relationship with a creative robot, perhaps you should learn to play an instrument!

– Louis McCallum, Queen Mary University of London (from the archive)

Watch the video Louis made with the Royal Institution about Mortimer:

More on …

Magazines …

Front cover of CS4FN issue 29 - Diversity in Computing

Subscribe to be notified whenever we publish a new post to the CS4FN blog.


This page and talk are funded by EPSRC on research agreement EP/W033615/1.

QMUL CS4FN EPSrC logos

Philippa Gardner bringing law and order to a wild west

Verified Trustworthy Software

Image by Paul Curzon

The computing world is a wild west, with bugs in software the norm, and malicious people and hostile countries making use of them to attack people, companies and other nations. We can do better. Just as in the original wild west, advances have happened faster than law and order can keep up. Rather than catch cyber criminals we need to remove the possibility. In software the complexity of our computers and the programs they run has increased faster than ways have been developed and put in place to ensure they can be trusted. It is important that we can answer precisely questions such as “What does this code do?” and “Does it actually do what is intended?”, but can also assure ourselves of what code definitely does NOT do: it doesn’t include trapdoors for criminals to subvert, for example. Philippa Gardner has dedicated her working life to rectifying this by providing ways to verify software, so mathematically prove such trust-based properties hold of it.

Programs are incredibly complicated. Traditionally, software has been checked using testing. You run it on lots of input scenarios and check it does the right thing in those cases. If it does you assume it works in all the cases you didn’t have time to check. That is not good enough if you want code to really be trustworthy. It is impossible to check all possibilities, so testing alone is just not good enough. The only way to do it properly is to also use engineering methods based on mathematics. This is the case, not just for application programs, but also for the software systems they run within, and that includes programming languages themselves. If you can’t trust the programming language then you can’t trust any programs written in that language. Building on decades of work by both her own team and others, Philippa has helped provide tools and techniques that mean complex industrial software and the programming languages they are written in can now be verified mathematically to be correct. Helping secure the web is one area she is making a massive contribution via the W3C WebAssembly (Wasm) initiative. She is helping ensure that programs of the future that run over the web are trustworthy. 

Programs written in programming languages are compiled (translated) into low level code (ie binary 1s and 0s) that can actually be run on a computer. Each kind of computer has its own binary instructions. Rather than write a compiler for every different machine, compilers often now use common intermediary languages. The idea is you have what is called a virtual machine – an imaginary one that does not really exist in hardware. You compile your code to run on the imaginary machine. A compiler is written for each language to compile it into the common low level language for that virtual machine. Then a separate, much simpler, translator can be written to convert that code into code for a particular real machine. That two step process is much easier than writing compilers for all combinations of languages and machines. It is also a good approach to make programs more trustworthy, as you can separately verify the separate, simpler parts. If programs compile to the virtual machine, then to be sure they cannot do harm (like overwrite areas of memory they shouldn’t be able to write to) you also only have to be sure that programs running on the virtual machine programs cannot , in general, do such harm.

The aim of Wasm is to make this all a reality for web programming, where visiting a web page may run a program you can’t trust. Wasm is a language with linked virtual machine that programming language compilers can be compiled into that itself will be trustworthy even when run over the web. It is based on a published formal specification of how the programming language and the virtual machine should behave.

As Philippa has pointed out, while some companies have good processes for ensuring their software is good enough, these are often kept secret.  But given we all rely on such software we need much better assurances. Processes and tools need to be inspectable by anyone. That has been one of the areas she has focussed on. Working on Wasm is a way she has been doing that. Much of her work over 30 years or so has been around the development and use of logics that can be used to mathematically verify that concurrent programs are correct. Bringing that experience to Wasm has allowed her to work on the formal specification conducting proofs of properties of Wasm that show it is trustworthy in various way, correcting definitions in the specification when problems are found. Her approach is now being adopted as the way to do such checking.

Her work with Wasm continues but she has already made massive steps to helping ensure that the programs we use are safe and can be trusted. As a result, she was recently awarded the BCS Lovelace medal for her efforts.

More on …

Magazines …

Front cover of CS4FN issue 29 - Diversity in Computing

Subscribe to be notified whenever we publish a new post to the CS4FN blog.


This blog and post is funded by EPSRC on research agreement EP/W033615/1.

QMUL CS4FN EPSRC logos

Soft squidgy robots

A smiling octopus
Image by OpenClipart-Vectors from Pixabay

Think of a robot and you probably think of something hard, metal, solid. Bang into one and it would hurt! But researchers are inventing soft robots, ones that are either completely squidgy or have squidgy skins.

Researchers often copy animals for new ideas for robots and lots of animals are soft. Some have no bones in them at all nor even hard shells to keep them safe: think slugs and octopuses. And the first soft robot that was “fully autonomous”, meaning it could move completely on its own, was called Octopod. Shaped like an Octopus, its body was made of silicone gel. It swam through the water by blowing gas into hollow tubes in its arms like a balloon, to straighten them, before letting the gas out again. 

Soft, squidgy animals are very successful in nature. They can squeeze into tiny spaces for safety or to chase prey, for example. Soft squidgy machines may be useful for similar reasons. There are plenty of good reasons for making robots soft, including

  • they are less dangerous around people, 
  • they can squeeze into small spaces,
  • they can be made of material that biodegrades so better for the planet, and
  • they can be better at gently gripping fragile things.

Soft robots might be good around people for example in caring roles. Squeezing into small spaces could be very useful in disaster areas, looking for people who are trapped. Tiny ones might move around inside an ill person’s body to find out what is wrong or help make them better.

Soft robotics is an important current research area with lots of potential. The future of robotics may well be squidgy.

Paul Curzon, Queen Mary University of London

More on …

Magazines …

Front cover of CS4FN issue 29 - Diversity in Computing

Subscribe to be notified whenever we publish a new post to the CS4FN blog.


This page and talk are funded by EPSRC on research agreement EP/W033615/1.

QMUL CS4FN EPSrC logos

An Wang’s magnetic memory

A golden metal torus
Image by Hans Etholen from Pixabay

An Wang was one of the great pioneers of the early days of computing. Just as the invention of the transistor led to massive advances in circuit design and ultimately computer chips, Wang’s invention of magnetic core memory provided the parallel advance needed in memory technology.

Born in Shanghai, An went to university at Harvard in the US, studying for a PhD in electrical engineering. On completing his PhD he applied for a research job there and was set the task of designing a new, better form of memory to be used with computers. It was generally believed that the way forward was to use magnetism to store bits, but no one had worked out a way to do it. It was possible to store data by for example magnetising rings of metal. This could be done by running wires through the rings. Passing the current in one direction set a 1, and in the other a 0 based on the direction of the magnetic field created.

If all you needed was to write data it could be done. However, computers, needed to be able to repeatedly read memory too, accessing and using the data stored, possibly many times. And the trouble was, all the ways that had been thought up to use magnets were such that as soon as you tried to read the information stored in the memory, that data was destroyed in the process of reading it. You could only read stored data once and then it was gone!

An was stumped by the problem just like everyone else, then while walking and pondering the problem, he suddenly had a solution. Thinking laterally, he realised it did not matter if the data was destroyed at all. You had just read it so knew what it was when you destroyed it. You could therefore write it straight back again, immediately. No harm done!

Magnetic-core memory was born and dominated all computer memory for the next two decades, helping drive the computer revolution into the 1970s. An took out a patent for his idea. It was drafted to be very wide, covering any kind of magnetic memory. That meant even though others improved on his design, it meant he owned the idea of all magnetic based memory that followed as it all used his basic idea.

On leaving Harvard he set up his own computer company, Wang Laboratories. It was initially a struggle to make it a success. However, he sold the core-memory patent to IBM and used the money to give his company the boost that it needed to become a success. As a result he became a billionaire, the 5th richest person in the US at one point.

Paul Curzon, Queen Mary University of London

More on …

Magazines …

Front cover of CS4FN issue 29 - Diversity in Computing

Subscribe to be notified whenever we publish a new post to the CS4FN blog.


This page and talk are funded by EPSRC on research agreement EP/W033615/1.

QMUL CS4FN EPSrC logos

Aaron and the art of art

Aaron is a successful American painter. Aaron’s delicate and colourful compositions on canvas sell well in the American art market, and have been exhibited worldwide, in London’s Tate Modern gallery and the San Francisco Museum of Modern Art for example. Oh and by the way, Aaron is a robot!

Yes, Aaron is a robot, controlled by artificial intelligence, and part of a lifelong experiment undertaken by the late Harold Cohen to create a creative machine. Aaron never paints the same picture twice; it doesn’t simply recall pictures from some big database. Instead Aaron has been programmed to work autonomously. That is, once it starts there is no further human intervention, Aaron just draws and paints following the rules for art that it has been taught.

Perfecting the art of painting

Aaron’s computer program has grown and developed over the years, and like other famous painters, has passed though a number of artistic periods. Back in the early 1970s all Aaron could do was draw simple shapes, albeit shapes that looked hand drawn – not the sorts of precise geometric shapes that normal computer graphics produced. No, Aaron was going to be a creative artist. In the late 1970s Aaron learned something about artistic perspective, namely that objects in the foreground are larger than objects in a picture’s background. In the late 80s Aaron could start to draw human figures, knowing how the various shapes of the human body were joined together, and then learning how to change these shapes as a body moved in three dimensions. Now Aaron knows how to add colour to its drawings, to get those clever compositions of shades just spot on and to produce bold, unique pictures, painted with brush on canvas by its robotic arm.

It’s what you know that counts

When creating a new painting Aaron draws on two types of knowledge. First Aaron knows about things in the real world: the shapes that make up the human body, or a simple tree. This so called declarative (declared) knowledge is encoded in rules in Aaron’s programming. It’s a little like human memory: you know something about how the different shapes in the world work. This information is stored somewhere in your brain. The second type of knowledge Aaron uses is called procedural knowledge. Procedural knowledge allows you to move (process) from a start to an end through a chain of connected steps. Aaron, for example, knows how to proceed through painting areas of a scene to get the colour balance correct and in particular, getting the tone or brightness of the colour right. That is often more artistically important than the actual colours themselves. Inside Aaron’s computer program these two types of knowledge, declarative and procedural, are continuously interacting with each other in complex ways. Perhaps this blending of the two types of knowledge is the root of artistic creativity?

Creating Creativity

Though a successful artist, and capable of producing pleasing and creative pictures, Aaron’s computer program still has many limitations. Though the pictures look impressive, that’s not enough. To really understand creativity we need to examine the process by which they have been made. We have an ‘artist’ that we can take to pieces and examine in detail. Studying what Aaron can do, given we know exactly what’s been programmed into it, allows us to examine human creativity. What about it is different from the way humans paint, for example? What would we need to add to Aaron to make its process of painting more similar to human creativity?

Not quite human

Unlike a human artist Aaron cannot go back and correct what it does. Studies of great artist’s paintings often show that under the top layer of paint there are many other parts of the picture that have been painted out, or initial sketches that have been redrawn as the artist progresses through the work, perfecting it as they go. Aaron always starts in the foreground of the picture and moves toward painting the background later, whereas human artists can chop and change which part of a picture to work on to get it just right. Perhaps in the future, with human help Aaron or robots like him will develop new human-like painting skills and produce even better paintings. Until then the art world will need to content itself with Aaron’s early period work.

the CS4FN team (updated from the archive)

Some of Aaron’s (and Harold COhen’s) work is on display at the Tate modern until June 2025 as part of the Electric Dreams exhibition.

More on …

Magazines …

Front cover of CS4FN issue 29 - Diversity in Computing

Subscribe to be notified whenever we publish a new post to the CS4FN blog.


This page and talk are funded by EPSRC on research agreement EP/W033615/1.

QMUL CS4FN EPSrC logos

Sue Sentance: Teaching the world to program

A figure sprinting: silhouette binary
Image by Gerd Altmann from Pixabay (edited)

How do you learn to program? How do you best teach programming. When the English school curriculum changed, requiring even primary school students to learn programming, suddenly this became an important question for school teachers who had previously not had to even think about it. Teaching is about much more than knowing the subject, or even knowing how to teach. It also needs knowledge and skill in how to teach each specific subject. Many teachers had to learn these new skills often with no background at all. Luckily, Sue Sentance came to the rescue with PRIMM, a simple framework for how to teach programming suitable for schools. She was awarded the BCS Lovelace prize for the work.

If you were a novice wanting to develop maker skills, whether building electronics, making lego, doing origami or knitting, you might start by following instructions created by someone else for a creation of theirs. Many assumed that was a sensible way to teach programming too, but it isn’t. This approach, sometimes called “copy code” where a teacher provides a program, and students type it in, is a very poor way to learn to program. But if you can’t do the obvious, what do you do?

Sue came up with PRIMM as a way to help teachers. It stands for Predict, Run, Investigate, Modify and Make, giving a series of steps a programming lesson should follow.

The teacher still provides programs, but instead of typing the code in line by line the students first read it and try to predict what it does. This follows the way people learn to write – they first read (lots!)

Having made a prediction, the students run the program. (They don’t type it in at all, as there is little point in doing that, but are given the file ready to run), They now act like a scientist and see if their prediction is correct. Perhaps they predict the program prints 

Hello World

all on one line. By running the program they find out if they were right or not. If they were then it confirms their understanding. If it doesn’t then this suggests there was something more to understand. If the program instead printed

Hello
World

over two lines, then there is something to work out about what makes a program move to another line. The class discuss the results and compare their predictions with the results. Can they explain why it behaved the way it did?

Next they investigate the program in more depth. The teacher can set a variety of exercises to do this. One very powerful way is stepping through program fragments line by line (doing what in industry is called a code walkthrough and is also called dry running or tracing the code). 

Based on the deeper understanding gained by this they then attempt to modify the original program to do something very slightly different – for example, to print 

Hello, Paul. 
How are you?

This is more exprementation to check and expand their understanding. By making deliberate changes with specific results in mind, they can now purposefully make sure they really do understand a programming construct. As before, if the program does something different to expected then the reason can be explored and that is used to correct what they thought.

If they have fully understood the code then this should by now be fairly easy.

Finally they make a program of their own. Based on the understanding gained they create a new specific  program that uses the new constructs (like how to print a message, get input or make decisions) that they now understand. This program should solve a different problem. For example if they just played with a program containing an if statement, they might now write a simple quiz program, or simulates a vending machine where items cost different amounts. .

Part of the reason that PRIMM has been successful is that it is not only a good way to learnt to program but it gives a clear structure to lessons that can be repeated with each construct to be covered and so makes a natural framework for planning lessons around.

Sue originally developed PRIMM with local schools she was working with in mind, but it works so well, solving a specific problem teachers had everywhere, that it is now used worldwide in countries introducing programming in schools.

Women do not figure greatly in the early history of science and maths just because societal restrictions, prejudices and stereotypes meant few were given the chance. Those who were like Maria Cunitz, showed their contributions could be amazing. It just took the right education, opportunities, and a lot of dedication. That applies to modern computer science too, and as the modern computer scientist, Karen Spärck Jones, responsible for the algorithm behind search engines said: “Computing is too important to be left to men.”

– Paul Curzon, Queen Mary University of London

More on …

Magazines …

Front cover of CS4FN issue 29 - Diversity in Computing

Subscribe to be notified whenever we publish a new post to the CS4FN blog.


This page and talk are funded by EPSRC on research agreement EP/W033615/1.

QMUL CS4FN EPSRC logos

Ancient Egyptian Numerals

How data is represented is an important part of computer science. There are lots of ways numbers can be represented. Choosing a good representation can make things easier or harder to do. The Ancient Egyptians had a simple way using hieroglyphs (symbols). It is similar to Roman Numerals but simpler. 

They represented numbers 1 to 9 with a hieroglyph with that number of straight lines. They arranged them into patterns (a bit like we do dots on a dice). The patterns make them easier to recognise. They used an upside down U shape for 10, two of these for 20, and so on. Their symbol for 10 also meant a “cattle hobble”. They then had a new symbols for each power of 10 up to a million. So 100 is the hieroglyph for a coil of rope.

Egyptian Numbers hundreds.jpg
Image by CS4FN

The hieroglyph for the number 1000 was a water lily.

Egyptian Heiroglyph for 1000: a waterlily
Image by CS4FN

The hieroglyph for a million, which also rather sensible meant ‘many’, was just the hieroglyph of the god Hey who was the personification of eternity.

To make a number you just combined the hieroglyph for the ones, tens, hundreds and so on.

The Ancient Egyptian number system makes it very easy to write numbers and to add and subtract numbers. Big numbers are fairly compact, though take up more space than our decimals. It is easy to convert a tally representation into this system too. More complicated things like multiplication are harder to do. Computers use binary representation because they make all the main operations easy to do using logic. Ultimately it is all about algorithms. The Egyptians had easy to follow algorithms for addition and subtraction to go with their number representation. We have devised algorithms that allow computers to do all the calculations they do as quickly as possible using a binary representation

Paul Curzon, Queen Mary University of London

To do…

Try doing some sums as an Ancient Egyptian would – without converting to our numbers. What is the algorithm for adding Egyptian numbers? Do multiplication using a repeated addition algorithm – to do 3 x 4 you 4 to zero 3 times.

More on..

An earlier version of this article first appeared on Teaching London Computing.

QMUL CS4FN EPSrC logos

Hiroshi Kawano and his AI abstract artist

Piet Mondrian is famous for his pioneering pure abstract paintings that consist of blocks of colour with thick black borders. This series of works is iconic now. You can buy designs based on them on socks, cards, bags, T-shorts, vases, and more, He also inspired one of the first creative art programs. Written by Hiroshi Kawano it created new abstract art after Mondrian.

An Artificial Mondrian style picture of blocks of primary colours with blck borders.
Image by CS4FN after Mondrian inspired by Artificial Mondrian

Hiroshi Kawano was himself a pioneer of digital and algorithmic art. From 1964 he produced a series of works that were algorithmically created in that they followed instructions to produce the designs, but those designs were all different as they included random number generators – effectively turning art into a game of chance, throwing dice to see what to do next. Randomness can be brought in in this way to make decisions about the sizes, positions, shapes and colours in the images, for example.

His Artificial Mondrian series from the late 1960s were more sophisticated than this though. He first analysed Mondrian’s paintings determining how frequently each colour appeared in each position on the canvas. This gave him a statistical profile of real Mondrian works. His Artificial Mondrian program then generated new designs based on coloured rectangles but where the random number generator matched the statistical pattern of Mondrian’s creative decisions when choosing what block of colour to paint in an area. The dice were in effect loaded to match Mondrian’s choices. The resulting design was not a Mondrian, but had the same mathematical signature as one that Mondrian might paint. One example KD 29 is on display at the Tate modern this year (2025) until June 2025 as part of the Electric Dreams exhibition (you can also buy a print from the Tate Modern Shop).

Kawano’s program didn’t actually paint, it just created the designs and then Hiroshi did the actual painting following the program’s design. Colour computer printers were not available then but the program could print out the patterns of black rectangles that he then coloured in.

Whilst far simpler, his program’s approach prefigures the way modern generative AI programs that create images work. They are trained on vast numbers of images, from the web, for example. They then create a new image based on what is statistically likely to match the prompt given. Ask for a cat and you get an image that statistically matches existing images labelled as cats. Like his the generative AI programs are also combining algorithm, statistics from existing art, and randomness to create new images.

Is such algorithmic art really creative in the way an artist is creative though? It is quite easy (and fun) to create your own Mondrian inspired art, even without an AI. However, the real creativity of an artist is in coming up with such a new iconic and visually powerful art style in the first place, as Piet Mondrian did, not in just copying his style. The most famous artists are famous because they came up with a signature style. Only when the programs are doing that are they being as creative as the great human artists. Hiroshi Kawano’s art (as opposed to his program’s) perhaps does pass the test as he came up with a completely novel medium for creating art. That in itself was incredibly creative at the time.

Paul Curzon, Queen Mary University of London

More on …

Magazines …

Front cover of CS4FN issue 29 - Diversity in Computing

Our Books …


Subscribe to be notified whenever we publish a new post to the CS4FN blog.


This page and talk are funded by EPSRC on research agreement EP/W033615/1.

QMUL CS4FN EPSrC logos

Piet Mondrian and Image Representation

Image after Mondrian by CS4FN

Piet Mondrian was a pioneer of abstract art. He was a Dutch painter, famous for his minimalist abstract art. His series of grid-based paintings consisted of rectangles, some of solid primary colour, others white, separated by thick black lines. Experiment with Mondrian-inspired art like this one of mine, while also exploring different representations of images (as well as playing with maths). Mondrian‘s art is also a way to to learn to program in the image representation language SVG.

We will use this image to give you the idea, but you could use your own images using different image representations, then get others to treat them as puzzles to recreate the originals.


Vector Images

One way to represent an image in a computer is as a vector image. One way to think of what a vector representation is, is that the image is represented as a series of mathematically precise shapes. Another way to think of it is that the image is represented by a program that if followed recreates it. We will use a simple (invented) language for humans to follow to give the idea. In this language a program is a sequence of instructions to be followed in the order given. Each instruction gives a shape to draw. For example,

Rectangle(Red, 3, 6, 2, 4)
A grid showing a square as in the accompanying instructions.
Image by CS4FN

means draw a red rectangle position 3 along and 6 down of size 2 by 4 cm.

Rectangle is the particular instruction giving the shape. The values in the brackets (Red, 3, 6, 2, 4) are arguments. They tell you the colour to fill the shape in, its position as two numbers and its size (two further numbers). The numbers refer to what is called a bounding box – an invisible box that surrounds the shape. You draw the biggest shape that fits in the box. All measurements are in cm. With rectangles the bounding box is exactly the rectangle.

In my language, the position numbers tell you where the top left corner of the bounding box is. The first number is the distance to go along the top of the page from the top left corner. The second number is the distance to go down from that point. The top left corner of the bounding box in the above instruction is 3cm along the page and 6cm down.

The final two numbers give the size of the bounding box. The first number is its width. The second number is its height. For a rectangle, if the two numbers are the same it means draw a square. If they are different it will be a rectangle (a squashed square!)

Here is a program representation of my Mondrian-inspired picture above (in my invented langigae).

1. Rectangle(Black, 0, 0, 1, 15)
2. Rectangle(Black, 1, 0, 14, 1)
3. Rectangle(Black, 15, 0,1, 15)
4. Rectangle(Black, 9, 1, 1, 14)
5. Rectangle(Black, 1, 5, 14, 1)
6. Rectangle(Black, 3, 6, 1, 9)
7. Rectangle(Black, 6, 6, 1, 4)
8. Rectangle(Black, 12, 6, 1, 6)
9. Rectangle(Black, 1, 8, 2, 1)
10. Rectangle(Black, 13, 9, 2, 1)
11. Rectangle(Black, 4, 10, 5, 1)
12. Rectangle(Black, 10, 12, 5, 1)
13. Rectangle(Black, 0, 15, 16, 1)

14. Rectangle(Blue, 1, 1, 8, 4)
15. Rectangle(Red, 7, 6, 2, 4)
16. Rectangle(Red, 10, 13, 5, 2)
17. Rectangle(Yellow, 13, 6, 2, 3)
18. Rectangle(Yellow, 1, 9, 2, 6)
19. Rectangle(White, 10, 1, 5, 4)
20. Rectangle(White, 1, 6, 2, 2)
21. Rectangle(White, 4, 6, 2, 4)
22. Rectangle(White, 10, 6, 2, 6)
23. Rectangle(White, 13, 10, 2, 2)
24. Rectangle(White, 4, 11, 5, 4)

Create your own copy of my picture by following these instructions on squared paper. Then create your own picture and write instructions of it for others to follow to recreate it exactly.


Mondrian in SVG

My pseudocode language above was for people to follow to create drawings on paper, but it is very close to a real industrial standard graphics drawing language called SVG. If you prefer to paint on a computer rather than paper, you can do it by writing SVG programs in a Text Editor and then viewing them in a web browser.

In SVG an instruction to draw a rectangle like my first black one in the full instructions above is just written

<rect fill="black" x="0" y="0" width="1" height="15" />

The instruction starts < and end />. “rect” says you want to draw a rectangle (other commands draw other shapes) and each of the arguments are given with a label saying what they mean, so x=”0″ means this rectangle has x coordinate at 0. A program to draw a Mondrian inspired picture is just a sequence of commands like this. However you need a command at the start to say this is an SVG program and give the size/position of the frame (or viewBox) the picture is in. My Mondrian-inspired picture is 16×16 so my picture has to start:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">

An SVG program also has to have an end command.

</svg>

Put all that together and the program to create my picture can be written:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">

<rect fill="black" x="0" y="0" width="1" height="15" /> 
<rect fill="black" x="1" y="0" width="14" height="1" />
<rect fill="black" x="15" y="0" width="1" height="15" /> 
<rect fill="black" x="9" y="1" width="1" height="14" /> 
<rect fill="black" x="1" y="5" width="14" height="1" /> 
<rect fill="black" x="3" y="6" width="1" height="9" /> 
<rect fill="black" x="6" y="6" width="1" height="4" /> 
<rect fill="black" x="12" y="6" width="1" height="6" /> 
<rect fill="black" x="1" y="8" width="2" height="1" /> 
<rect fill="black" x="13" y="9" width="2" height="1" /> 
<rect fill="black" x="4" y="10" width="5" height="1" /> 
<rect fill="black" x="10" y="12" width="5" height="1" /> 
<rect fill="black" x="0" y="15" width="16" height="1" />

<rect fill="blue" x="1" y="1" width="8" height="4" /> 
<rect fill="red" x="7" y="6" width="2" height="4" /> 
<rect fill="red" x="10" y="13" width="5" height="2" /> 
<rect fill="yellow" x="13" y="6" width="2" height="3" /> 
<rect fill="yellow" x="1" y="9" width="2" height="6" /> 
<rect fill="white" x="10" y="1" width="5" height="4" /> 
<rect fill="white" x="1" y="6" width="2" height="2" /> 
<rect fill="white" x="4" y="6" width="2" height="4" /> 
<rect fill="white" x="10" y="6" width="2" height="6" /> 
<rect fill="white" x="13" y="10" width="2" height="2" /> 
<rect fill="white" x="4" y="11" width="5" height="4" />

</svg>

Cut and paste this program into a Text editor*. Save it with name mondrian.svg and then just open it in a browser. See below for more on text editors and browsers. The text editor sees the file as just text so shows you the program. A browser sees the file as a program which it executes so shows you the picture.

Now edit the program to explore, save it and open it again.

  • Try changing some of the colours and see what happens.
  • Change the coordinates
  • Once you have the idea create your own picture made of rectangles.

Shrinking and enlarging pictures

One of the advantages of vector graphics is that you can enlarge them (or shrink them) without losing any of the mathematical precision. Make your browser window bigger and your picture will get bigger but otherwise be the same. Doing a transformations like enlargement on the images is just a matter of multiplying all the numbers in the program by some scaling factor. You may have done transformations like this at School in Maths and wondered what the point was. No you know one massively important use. It is the basis of a really flexible way to create and store images. Of course images do not have to be flat, they can be 3-dimensional and the same maths allow you to manipulate 3D computer images ie CGI (computer generated imagery) in films and games.

by Paul Curzon, Queen Mary University of London

An earlier version of this article originally appeared on Teaching London Computing.


*Text Editing Programs and saving files

On a Windows computer you can find notepad.exe using either the search option in the task bar (or Windows+R and start typing notepad…). On a Mac use Spotlight Search (Command+spacebar) to search for TextEdit. Save your file as an SVG using the .svg (not .txt) as the ending and then open it in a browser (on a Mac you can grab the title of the open file and drag and drop it into a web page where it will open as the drawn image).

More on …

Magazines …

Front cover of CS4FN issue 29 - Diversity in Computing

Our Books …


Subscribe to be notified whenever we publish a new post to the CS4FN blog.


This page and talk are funded by EPSRC on research agreement EP/W033615/1.

Maria Cunitz: astronomer and algorithmic thinker

When did women first contribute to the subject we now call Computer Science: developing useful algorithms, for example? Perhaps you would guess Ada Lovelace in the Victorian era so the mid 1800s? She corrected one of Charles Babbage’s algorithms for the computer he was trying to build. Think earlier. Two centuries or so earlier! Maria Cunitz improved an algorithm published by the astronomer Kepler and then applied it to create a work more accurate than his.

A stary sky with the milky way
Image by Rene Tittmann from Pixabay

Very few women, until the 20th century were given the opportunities to take part in any kind of academic study. They did not get enough education, and even if they did were not generally welcome in the circles of mathematicians and natural philosophers. Maria, who was Polish from an educated family of doctors and scientists, was tutored and supported in becoming a polymath with an interest in lots of subjects from history to mathematics. Her husband was a doctor who also was interested in astronomy something that became a shared passion with him teaching her the extra maths she needed. They lived at the time of the 30 years war that was waged across most of Europe. It was a spat turned into a war about religion between catholic and protestant countries. In Poland, where they lived, it was not safe to be a protestant. The couple had a choice of convert or flee, so left their home taking sanctuary in a convent.

This actually gave Cunitz a chance to pursue an astronomical ambition based on the work of Johannes Kepler. Kepler was famous for his three Laws of Planetary Motion published in the early 1600s on how the planets orbit the sun. It was based on the new understanding from Copernicus that the planets rotated around the sun and so the Earth was not the centre of everything. Kepler’s work gave a new way to compute the positions of the planets,

Cunitz had a detailed understanding of Kepler’s work and of the mathematics behind it, She therefore spent her time in the convent computing tables that gave the positions of all the planets in the sky. This was based on a particular work of Kepler called the Rudolphine Tables. It was one of his great achievements stemming from his planetary laws. Such astronomical tables became vital for navigating ships at sea, as the planetary positions could be used to determine longitude. However, at the time, the main use was for astrology as casting someone’s horoscope required knowledge of the precise positions of the planets. In creating the tables, Cunitz was acting as an early human computer, following an algorithm to compute the table entries. It involved her doing a vast amount of detailed calculation.

Kepler himself spent years creating his version of the tables. When asked to hurry up and complete the work he said: “I beseech thee, my friends, do not sentence me entirely to the treadmill of mathematical computations…” He couldn’t face the role of being a human computer! And yet a whole series of women who came after him dedicated their lives to doing exactly that, each pushing forward astronomy as a result. Maria herself took on the specific task he had been reluctant to complete in working out tables of planetary positions.

Kepler had published his algorithm for computing the tables along with the tables. Following his algorithm though was time consuming and difficult, making errors likely. Maria realised it could be improved upon, making it simpler to do the calculations for the tables and making it more likely they were correct. In particular, Kepler was using logarithms for the calculations. but she realised that was not necessary. Sacrificing some accuracy in the results for the sake of the avoidance of larger errors, the version she followed was even simpler. By the use of algorithmic thinking she had avoided at least some of the chore that Kepler himself had dreaded. This is exactly the kind of thing good programmers do today, improving the algorithms behind their programs so the programs are more efficient. The result was that Maria produced a set of tables that was more accurate than Kepler’s, and in fact the most accurate set of planetary tables ever produced to that point in time. She published them privately as a book “Urania Propitia’ in 1650. Having a mastery of languages as well as maths and science, she, uniquely, wrote it in both German and Latin.

Women do not figure greatly in the early history of science and maths just because societal restrictions, prejudices and stereotypes meant few were given the chance. Those who were like Maria Cunitz, showed their contributions could be amazing. It just took the right education, opportunities, and a lot of dedication. That applies to modern computer science too, and as the modern computer scientist, Karen Spärck Jones, responsible for the algorithm behind search engines said: “Computing is too important to be left to men.”

– Paul Curzon, Queen Mary University of London

More on …

Magazines …

Front cover of CS4FN issue 29 - Diversity in Computing

Our Books …


Subscribe to be notified whenever we publish a new post to the CS4FN blog.


This page and talk are funded by EPSRC on research agreement EP/W033615/1.