Can a turtle draw your face?

Turtle is a system used to show children how programming works in a simple, intuitive way. It was originally part of an educational programming language called Logos that was invented by Cynthia Solomon, Wally Feuerzig and Seymour Papert in the late 1960s. For people like me, who got into programming a decade or two after that, turtles and logos were part of the conversation in our classrooms, offices, and labs. This was true even if we worked in more complex languages—like Lisp, C, and Prolog—because we understood the value of those simple, intuitive ways.

In short, Turtle lets you draw shapes and pictures by issuing instructions to a small fake turtle. For example, if you tell it to move forward one centimeter, it draws a line one centimeter long. If you tell it to turn 90 degrees to the left and move forward another centimeter, it draws another line one centimeter long at a 90 degree angle with the first. There’s a start on a picture, though there’s certainly hope for more interesting ones than just two lines that meet at right angles. So “move forward a given distance” and “turn counterclockwise through a given angle” are two instructions to the turtle. There are two more: “pen down” and “pen up”. In the example above, two lines are drawn because you actually “penned down” the turtle. You’d use “pen up” before another move instruction—for example, if the pen must move to a new location without drawing a line.

Clear so far, trust me? Now suppose you give the turtle this series of instructions: lower the pen, move forward one centimeter, rotate 90 degrees counterclockwise, turn the pen up. Suppose you ask the turtle to do this set four times. Think about it: You’ve made a square one centimeter on each side. The tortoise is back where it started. Plus, you’ve designed a program—this instruction set, repeated four times—that, if simple, is still a step in the programming world. A program you write for a computer is actually a series of instructions, some possibly repeated a few times, some possibly dependent on the outcome of others, etc.

And if that’s how you get the turtle to form a square, you can figure out how to make it a triangle, a hexagon, or a rectangle with both diagonals marked off. As you work on them, you’ll learn how to program even more complex images: a pyramid, a house, the skyline of a city… maybe even a face?

Ah, and there’s a story. Stay with me.

Just a few days ago, the popular Youtube channel Numberphile put out some videos that featured a version of the turtle. In them, Matt Henderson, a mathematician in Edinburgh, plots some interesting turtle curves driven by numbers. This is how it works. Assume a “pen down” in the beginning, so the turtle will always be pulling something as it moves. Also assume a default “move one centimeter” instruction. That is, every time the tortoise turns from a specified angle, it draws a line one centimeter long. Now Henderson divides 360 degrees of a circle into ten equal arcs, each with an angle of 36 degrees. He labels them 0 through 9; That is, 0 means to turn clockwise through 0 degrees, or not at all; 1 means turning 36 degrees; 2, 72 degrees; And so on. He thus puts the turtle up to understand the points and act on them.

Think about what happens when you feed a turtle a series of digits. If we start by placing the tortoise horizontally to the right and then give it 0, 2, and 1, what do we get? We get three lines, each one centimeter long; The first is horizontal, the second makes an angle of 72 degrees (36 x 2) with the first, the third makes an angle of 36 degrees with the second. What about multiple 5s? First rotates the turtle 180 degrees (36 x 5) and draws a line going horizontally to the left. The second 5 rotates it 180 degrees again, so it goes to the right this time, over the same line. Thus many 5s leave us with only one row. Similarly, you can see that multiple 0s produce a long horizontal line extending to the right.

Now you get the picture. So Henderson gave the turtle different sequences of numbers. e.g. a decimal spread of 1/7, or 0.142857142857… This results in a stylized symmetric flower, with a fixed pattern that repeats after a dot. Or 1/119, the decimal expansion of 0.00840336…— Another beautiful flower-like composition, with a different pattern that repeats. The point here is that any number that can be expressed by a fraction formed by two integers—”rational” numbers whose decimal expansion either ends somewhere or is a sequence of digits that repeats ad infinity Is – repeating the pattern will produce those symmetrical shapes.

Which raises the question, what about an irrational number? Remember that the decimal expansion of irrationals never ends and never settles in repetitions. Henderson fed his tortoise one such number, p (3.1415926…). The result—this view of P, if you like—is nothing you would describe as elegant, with no symmetry and no obvious repeating patterns. This is “a good way to see the clear distinction between rational numbers and irrational numbers”, remarks Henderson.

And yet, as the tortoise passes through a thousand digits P-or other irrationals – the diagram itself begins to take on a strange fascination, sometimes even hinting at exotic figures. Is that the Indian subcontinent? Britain’s island? Mona Lisa?

So you wonder: if the tortoiseshell turtle uses p to draw like this with no end, will it eventually produce a face? If what the tortoise generates is a visual representation of p, is the Mona Lisa encoded, in the sense of this tortoise, at any rate, somewhere in the digits of p? Which is why Henderson ends her clip by thinking to herself, “Can someone send me the number that draws my face?” Within days, Felix Engelmann, a postdoc from Copenhagen, did just that. His number is what creates a prevalent impression of Henderson. .. longer than 250,000 points.

And what is our elegant tortoiseshell of Archie? Someone finds him wandering in the garden and, assuming he is doing Archie a favor, he also assumes that he is a tortoise. He took Archie out to sea. He threw her in. We mourned for months.

Numberphile Video with Matt Henderson and the Turtles

Felix Engelman’s Attempt

Dilip D’Souza now lives in Mumbai and writes for his dinner. His Twitter handle is @DeathEndsFun. Is

subscribe to mint newspaper

, Enter a valid email

, Thank you for subscribing to our newsletter!

Never miss a story! Stay connected and informed with Mint.
download
Our App Now!!

,