Early in the course I introduce Boolean values and conditional evaluation (we use the language Racket in this course, and teach the special form `cond`

here; other languages might use an `if`

statement). As a case study of using `cond`

, I explore speeding fines. Here’s the problem setup:

If you’re caught driving over the speed limit on Ontario highways, you might be punished with a fine. The precise amount of the fine depends on how fast you were driving. As of 2019, the penalty structure was as follows:

Amount by which you exceeded the speed limit |
Amount you pay |

Less than 20 km/h | $3.00 per km/h over the speed limit |

At least 20 km/h but less than 30 km/h | $4.50 per km/h over the speed limit |

At least 30 km/h but less than 50 km/h | $7.00 per km/h over the speed limit |

At least 50 km/h | $9.75 per km/h over the speed limit. |

(Highway Traffic Act, 1990)

Let’s turn this into a function `speeding-fine`

that consumes a speed in km/h and produces the corresponding fine.

The lesson goes on to present the solution, which looks like this:

(define (speeding-fine speed) (cond [(< speed 100) 0] [(and (>= speed 100) (< speed 120)) (* 3.00 (- speed 100))] [(and (>= speed 120) (< speed 130)) (* 4.50 (- speed 100))] [(and (>= speed 130) (< speed 150)) (* 7.00 (- speed 100))] [(>= speed 150) (* 9.75 (- speed 100))]))

If Racket isn’t your cup of tea, don’t worry about it too much. The important part of the function definition is the line `[(< speed 100) 0]`

, which translates to “if your speed was less than 100 km/h, you pay a fine of zero dollars”.

On the discussion boards, a student made this observation in response:

It’s just a technicality since the math works out either way, but the first condition should be

`[(<= speed 100) 0]`

rather than`[(< speed 100) 0]`

because there is no fine for driving exactly at the speed limit. All the subsequent iterations of the example have the same issue.

In other words, driving at precisely 100 km/h should count as “not speeding”, whereas I counted it as “speeding” (by omitting it from the first condition). The choice of `<`

vs. `<=`

doesn’t affect the result of the computation, but there’s a philosophical question here. What do you think? Did I make a mistake?

In fact, I thought about this quite a bit when writing this lesson, so I had a comically long answer for the student. I created this post to share that response. (I was particularly pleased to be able to incorporate recent current events by suddenly pivoting to an unexpected connection. It’s a rhetorical device that I definitely borrowed from the blog of my old friend Eric Lippert.)

Hi, author of the course here. I’m *delighted* that you raised this point. I went back and forth several times over the choice of `<`

vs. `<=`

in that example. I think it’s actually a very subtle question, and I could probably write a 5000-word essay about it. I won’t! But let me try to explain my choice.

**Note to students: this is beyond anything you need to care about. As the poster notes, this is a technicality, because it doesn’t affect the behaviour of the function (why not?). So feel free to ignore this and complete Module 02 without thinking about it.**

The main reason I went with `<`

is for consistency with the other conditions. The law definitely says, e.g., “less than 20 km/h” to define a tier for the fine structure, so we know we’ll need a `<`

in the second and all subsequent cases. I thought the code would look simpler with a `<`

for the speed limit too, and I had the luxury of making that choice because it doesn’t matter mathematically (whereas it *does* matter at the higher tiers).

But there’s a subtler mathematical point here. What *is* speed? In particular, is it a continuous or discrete quantity? There’s only one person qualified to answer this question: the rapper Kanye West.

Earlier this year, Yeezy announced that he was running for President of the US. It was only later that he realized that you can’t just *say* that and have it be true—there are forms to fill out, signatures to gather, etc. You have to get on the ballot in every state. He tried to get on the ballot in Wisconsin, which had a filing deadline of 5:00pm on August 4th. He submitted the forms 14 seconds after the stroke of 5:00pm, and was told that the deadline had passed. Predictably, his lawyers sent a 23-page complaint to the election commission, arguing that the entire minute of 5:00pm technically counts as On Time, because the law doesn’t talk about seconds. (See this article for more.)

So, what *is* a deadline? Is it a finite interval of time, like “the minute of 5:00pm”? Or is it an instantaneous transition from “on time” to “late”? And what’s a speed limit? Is it a continuous range of speeds, say [100,101) km/h, or is it the infinitesimal transition from less than 100 to more than 100? If it’s instantaneous, what would it mean to file your paperwork at *exactly* 5:00pm, or to travel at *exactly* 100 km/h? The, uh, good news is that it’s physically impossible to do either; or rather, the laws of physics don’t permit us to measure time or speed accurately enough to know that you’re doing that. Given enough digits of precision, every clock and radar gun will put you either before the threshold or after it, never on it.

I doubt any of this has ever been tested in court (but I would *love* to see that happen). The real world just isn’t set up to make these kinds of distinctions, and thank goodness. We avoid these transitional areas—you might get pulled over for going 10 km/h over the speed limit, but probably not for going 0.1 km/h over the speed limit (I hope you can afford the $0.30 ticket). And so, from a surprisingly deep philosophical perspective, I didn’t sweat the difference between `<`

and `<=`

too much in writing the function, because it can’t possibly matter.

By the way, watch for this point to arise again in the course, in Lesson 04.7. There, I make a metaphor with Racket sports, and the question of whether “on the line” is in or out.

Have a good weekend!

]]>I’m freshly back from a weekend in Toronto, where I was participating in the Winter meeting of the Canadian Mathematical Society. I don’t normally attend math conferences, but this time around I was invited to a session entitled “The Art of Mathematics”, and it seemed natural to join in. As it happens, the session was mostly about using art in the context of mathematics *education*; my research, which uses math to make new art, was something of an outlier. Nevertheless, I saw lots of terrific ideas for deploying art in the mathematics classroom, and snuck into a second session on increasing diversity, something both math and CS desperately need.

I spoke about “Mathematical Animated GIFs”, an art form I’ve been tracking online for at least a few years now. I focused exclusively on artworks, setting aside both animated diagrams and memes. I made my own contribution to the genre at Bridges this year, with a paper on animated tilings; I plan to summarize that work and showcase the results in a separate post. Here I’ll offer a list of the artists, artworks, and visual devices I showed in my talk, in case anybody would like to review them and discover more.

I’d love to spend lots of time discussing the many artistic merits of the people mentioned below, but I’ll take a just-the-facts approach and list them. For each artist I showed two representative works.

**David Whyte, AKA beesandbombs**(www.instagram.com/davebeesbombs/)

I showed cylinders and wavy square (my names for them).**Paolo Ceric, AKA patakk**(patakk.tumblr.com/)

I showed twisty triangle and tube (my names).**Matthew DiVito, AKA mrdiv**(mrdiv.tumblr.com/)

I showed cage and diamond_lines.**David Szakaly, AKA davidope**(dvdp.tumblr.com)

I showed 140104 and 130207.**Charlie Deck, AKA bigblueboo**(bigblueboo.tumblr.com/)

I showed cube spiral and cube chasers.**A few of mine**

I showed some of my past experiments: concentric waves, Gingham Vortex II, and a hypocycloid juggling pattern.

Here are additional pointers to artists and their GIFs, which I’m adding to this post as they are suggested to me. Check back later for more!

- Matt Enlow offered a pointer to his work in the comments below.
- Andrew Glassner created many lovely animations using Processing. A lot of these are demonstrations for his online introductory programming course.

In my talk, I offered some thoughts on the toolkit of visual devices that these artists rely on in order to create looping animations. These devices are important, because a loop that’s too simple might come across as more “obvious” or less artistic. For each device, I showed two examples.

**There and back again:**Evolve outward to some point, then reverse what you did so you return to a point where you can close the loop. I showed polygons by Rob Cramer and 190622 by davidope.**Closed parameter loop:**Construct a design that lives in a space controlled by a small number of parameters. Then move through a closed, continuous path in that space of parameters. I showed 190725 by davidope and Fabergé Fluctuation by Tom Beddard (AKA subblue).**Figure/ground duality:**Break a loop into multiple “chapters”, where in each chapter a different subset of the elements in the design plays the role of foreground and animates over top of the remaining elements. Beesandbombs is surely the master of this form; I showed discs/squares and heptominoes.**2D/3D interplay:**Some artworks explore designs based on three-dimensional geometry, but which take on a strongly 2D interpretation from a specific viewpoint. That 2D interpretation is often “brittle”, in the sense that it can be used as a junction point in the animation to move to other 3D forms. I showed negative cube by bigblueboo and spincubes by beesandbombs.**Strange loops:**I borrow Hofstadter’s terminology in describing a loop that doesn’t return to its starting point, but to a new configuration that happens to be indistinguishable from it, like the impossible staircase in Escher’s Ascending and Descending. The result is usually paradoxical and highly compelling. I showed subversion by bigblueboo and scaling squares by beesandbombs.

I talked a little bit about introductory techniques for making your own mathematical animated GIFs. The easiest software I’ve found for this task is Processing. Processing is a self-contained programming environment that streamlines the sorts of animated drawing tasks that you’ll need for abstract GIF art.

In older versions of Processing, there was a library for exporting animated GIFs. Sadly, that library doesn’t seem to be compatible with Processing 3, at least not without extra work. Therefore I suggest you export a sequence of frames from Processing as static images (say, in PNG format) and then stitch them into a GIF using ImageMagick. On my Mac, that means opening a terminal window, going into the directory where I’ve saved all the image files, and using a command like

`convert -delay 2 -loop 0 *.png output.gif`

Sorry if that’s brief; this post isn’t intended to serve as a complete tutorial. I did give a quick live demonstration during the talk, culminating in a creating a GIF that I tweeted on the spot.

I hope you’ll follow the links above and learn more about this hypnotic art form. The lists above are not meant to be exhaustive or rigorous, just the results of my random wanderings. A more systematic study of artists and devices would make for an excellent interdisciplinary art/CS project. You might start by looking through the posts on Colossal tagged with “GIF”. In the meantime, I encourage you to comment with links to other mathematical GIF artists I may have missed (I’d be especially happy to have more gender diversity).

]]>**WARNING: ****It seems as if there may be a problem with the rendering engine that will cause severe flickering on some devices. If you have a seizure disorder or are otherwise sensitive to flickering, please don’t start the game. Sorry about that.**

If you’d actually like to play it, I hope the controls are simple enough:

- Left and right arrow keys to move the current block around the well.
- Up and down arrow keys to rotate the current block.
- Space bar to drop.
- P to pause.

You might need to click in the game window in order to get it to recognize your keystrokes.

Because of the extreme perspective, I expect the game is largely unplayable (though playing Tetris without being able to read the well is an interesting experience, akin to blindfold chess). If you really wish to get through it (the perspective zoom at the end of the level, inspired by Tempest, is pretty badass), press the D key to activate a more conventional Tetris visualization in an overlay.

There’s not much more to say about this experiment. The whole thing is written in P5.js, with the vector display simulation operating as WebGL shaders. The game doesn’t add much to the Tetris (or Tempest) genre, though I haven’t seen a Tetris variant in which the well can be a cylinder, and that turns out to be somewhat interesting. I love musical mashups, so it’s satisfying to contemplate game mashups as well.

Thanks for playing!

]]>Late last year I met Brian Poindexter through a mutual friend from graduate school. Poindexter was part of a team that had been selected to create a large-scale art installation at Burning Man 2019. They were designing a pavilion that would be clad in wooden screens featuring Islamic geometric patterns. Poindexter saw some of my work in this area, and recruited me to create the geometric designs for the screens.

The pavilion as a whole went through several iterations over the next six months or so. By May it had settled down into a five-sided pyramidal tower with decorative fins. My “canvas” would be five large trapezoids (the pyramid was actually a frustum—it was to have a small opening at the top). One of the faces would have an arched passage at its base; the others would have oval windows.

The team sent me CAD files for the sides of the pyramid, which was all I needed to start drawing prototypes. I explored three main ideas for the design; here, I’ve got the luxury of showing you the two designs that we rejected, together with the one we eventually picked.

Zellij refers to a style of Islamic geometric patterns found in Morocco, based on assemblies of tightly fitting glazed terracotta tiles. The shapes of most of the tiles are related to the Seal of Solomon, an eight-pointed star formed from two overlapping squares. Designs often feature a large central star with as many as 96 points, with constellations of smaller stars radiating out from the centre.

I learned most of what I know about this style of design from Jean-Marc Castera’s books. Castera’s explanation of Zellij factors a pattern into a high-level “skeleton” that delineates large regions, and a few standard patterns of tiles that are then used to fill in those regions. This approach is convenient for my oddly shaped canvas—I had some freedom to choose a skeleton that put interesting features in eye-catching places. Above, a 16-pointed star hovers over the portal, surrounded by a hatched Seal of Solomon (reminding me just a bit of the Eye of Providence). Two more 16-pointed stars flank the portal near the ground.

In the end, this design was too busy. It might also have proven too difficult to manufacture, as this level of detail may not have been reliably cuttable from sheets of plywood.

In a second approach, I imagined the trapezoid extended to a complete isosceles triangle, and calculated that the angle at the peak of that triangle would be around 26.9 degrees. That’s somewhere between 360/13 and 360/14. Hypothetically, then, it might be possible to fill the trapezoid with a design based on 13- or 14-fold rotational symmetry. A “wedge” taken out of such a design could be stretched to fit the trapezoid exactly, with lines of reflection symmetry running along the edges of the pyramid—mathematically, a very elegant idea! The hopefully imperceptible stretching even tickles my interest in near-misses.

Now, 13- and 14-fold geometry are quite rare (though not unheard of) in historical Islamic art, so there wasn’t a lot of precedent from which to draw. Fortunately, there’s some lovely contemporary work on the subject to serve as inspiration. In 2012, Jay Bonner and Marc Pelletier published a two-part paper (Part 1, Part 2) on systems for 7-fold Islamic patterns; Jay later published a lot of this material in his comprehensive book on the subject (to which I contributed a chapter). As it happens, the second of their papers had exactly the design I needed as a prototype: a pattern with 14-fold symmetry, from which I extracted a slice that I fit to the panel shape above.

Mathematically, this design works quite well; as you can see in the drawing, the sides of the trapezoid are lines of reflection of the original design. However, the team decided that it didn’t work as well *aesthetically*, which in the end takes precedence.

In the end, we ended up using a variation of one of the first patterns I proposed, really just as an initial example for testing. The design is a excerpt from a repeating pattern of 8- and 16-pointed stars, adapted directly from one of the most famous Islamic geometric patterns in history, found for example in the Alhambra in Spain:

Interestingly, this pattern straddles the design traditions of the two rejected prototypes above. Its structure can mostly be accounted for through a kind of “polygons-in-contact” technique advocated by Jay Bonner, which he used for his 14-pointed design, but some of it definitely borrows from the Moroccan Zellij tradition. This is also, by the way, one of the patterns that M.C. Escher (and his wife Jetta) drew in sketchbooks while visiting the Alhambra, and which profoundly inspired his quest to create “regular divisions of the plane” from figurative animal forms.

After fine-tuning the placement of the design relative to the structure of the pavilion, and stealing the hatching from the Zellij prototype, the team in California decided to move forward with this plan.

At this point (around July), Poindexter et al. went more-or-less incommunicado, as they worked on the serious challenges of actually manufacturing parts that could be hauled out to the playa and assembled. Indeed, I heard so little over the next couple of months that I didn’t even know if they had succeeded! Happily, after the dust had settled (har har) on Burning Man 2019, we reconnected and I finally got to see the results of our work.

The results are quite lovely! Many great photos of the installation can be found online, for example at DesignBoom and Dezeen. There’s an official website for the project, which will hopefully also be updated soon with a post-Burning Man report.

I didn’t know a lot about the inspiration for the project while I was working on it. Later I learned that it had been envisioned by the prominent architect John Marx, while Poindexter and many others formed the “Playa Muses”, who put the work together and brought it to Burning Man. The project as a whole was intended as an homage to heroic women and female empowerment, which makes me even happier to have participated.

Without ever having been to Burning Man myself, I hope I have managed to make a small contribution to its mythology, as part of an artwork that explores decidedly mythological themes.

]]>The artist M.C. Escher drew many lovely tilings, which he called “regular divisions of the plane”. He worked hard to ensure that his tilings were of lifelike animal forms such as birds and fish. He filled notebooks with hand-drawn sketches of tilings, many of which later found their way into his woodcuts. If you’d like a detailed account of these notebooks and their mathematical connections, I recommend Doris Schattschneider’s book *Visions of Symmetry*; A Google image search is also a quick way to see a lot of the drawings.

One of Escher’s lifelong obsessions was the representation of infinity in a finite work of art. He experimented with several ideas for fitting infinitely many tiles into a drawing, culminating in his famous Circle Limit prints based on hyperbolic geometry. But that’s a story for another day. Before that, he drew a number of tilings where tiles form rings or spirals that diminish towards a point at the centre of the drawing. I call your attention in particular to Fish, Path of Life I, Path of Life III, and Development II. His remarkable final print Snakes executes a cunning transition from a hyperbolic tiling near the edge of a disc to a spiral tiling near the centre. Since then, others have created similar drawings. For example, you’ll see a few in a gallery of images by Jos Leys.

Naturally, mathematicians and computer scientists have worked on techniques for creating new tilings in this style. For example, you can see some abstract spirals emerging in a Bridges paper by Robert Fathauer. It seems to me that there has been an uptick in this sort of work recently—I have been sent a few different scholarly manuscripts on spiral tilings to review for journals. However, these manuscripts go through painful contortions to attempt to express the construction of these tilings in awkward, unnatural ways. It turns out that there’s a beautiful and exceedingly simple idea for turning ordinary planar Escher tilings into spiral tilings, an idea I’d like to share here for anyone interested in pursuing research on this topic. It’s an old idea too—I include it in Section 5.3 of my 2002 PhD dissertation, and I certainly don’t claim to have invented it (more on this later).

Most of the rest of this post will explain the math needed to create spiral tilings. You’ll need to be familiar with some geometry, trigonometry, and the complex numbers. Even if you don’t want to work through the math, be sure to scroll down to the bottom: at the end, I’ll introduce a fun web-based tool I created to let you play around with these tilings yourself!

We’ll start with the exponential function . Here is Euler’s number, approximately 2.71828. The function is standard in modelling situations with rapid growth, like populations of organisms or compound interest.

We can extend the domain of the exponential function to the entire complex plane using standard laws for exponents together with Euler’s formula (Euler has a lot of things named after him!). For a given complex number , we end up with

In other words, thinking for a moment in terms of regular Cartesian coordinates, a point will get mapped to a new point , which can also be thought of (via polar coordinates) as a point at distance from the origin, making a counterclockwise angle of with the axis. Note that the and functions repeat with a period of ; therefore, a vertical column of points spaced out by multiples of , like fenceposts seen from above, will all get mapped to the same point by the exponential function. In practice, we might as well factor out this repetition: we can draw pictures by starting with a single horizontal slice of the complex plane of height , and mapping its contents through . What will that look like? We can start to get a handle on how images distort by looking at what happens to straight lines:

The picture on the left shows a square portion of our horizontal slice of the plane of height , which becomes the picture on the right after mapping through the complex exponential. Let’s consider each of the lines shown on the left.

- Sticking with Cartesian coordinates, the green vertical line consists of points of the form for all values of . These get mapped to points of the form on the right. Or, letting , we end up with the set of points for all . In other words, a circle centred on the origin, as shown.
- On the other hand, the orange horizontal line has a varying and a fixed , giving . The range of the real exponential function is all positive real numbers, so the image of the horizontal line is a radial line extending out from the origin at angle . In our drawing the image of the orange line looks a bit like an infinite “wedge”; that happens because I’m mapping the full thickness of the line, and that thickness gets crammed into a tighter space closer to the origin.
- General diagonal lines don’t map to simple shapes like lines or circles. It turns out that they become logarithmic spirals, where the slope of the line determines the pitch of the spiral. Logarithmic spirals arise frequently in nature (the Wikipedia page linked here gives some examples).
**Public Service Announcement:**the so-called*golden spiral*is a logarithmic spiral whose pitch is related to the golden ratio. But not every logarithmic spiral is golden, and*nature doesn’t favour golden spirals*. You’ll often see the claim that nautilus shells are related to the golden ratio, but there’s simply no connection; they do grow (approximately) logarithmically, but there’s nothing forcing them to become golden spirals.

Notice also that although this mapping distorts space quite a bit, it does preserve *angles*: the angle at which two curves cross on the right is the same as the angle between the two original lines on the left. Such mappings are called *conformal*.

Already we can start to see how patterns of lines that repeat in the plane can be turned into interesting spiral patterns:

In general, as long as the top and bottom edges of the drawing on the left match up seamlessly, the exponential map will turn it into a seamless spiral drawing on the right. The effect is a bit like rolling the horizontal slice up into a tube and then looking down the length of the tube (but not really: things don’t shrink in perspective quite as they do with our mapping here). Looked at another way, if you have a pattern that repeats over the whole plane in some direction, you can rotate and scale the pattern so that the repetition is vertical and has length . Then we know that the edges of the slice will line up.

My introduction to the mapping of patterns through the complex exponential function came from the 1992 paper “Two Conformal Mappings” by Robert Dixon, which I also cited in my dissertation. Dixon gave it the more evocative name “the antiMercator mapping”.

A tiling of the plane is called *periodic* if there are vectors (i.e., arrows) in two distinct directions along which you can slide the tiling and have it match up with itself exactly when you’re done. For example, if your tiling is an infinite square grid, you can slide it horizontally or vertically by the edge length of a single square, and the tiling will look the same. We can even exploit this fact to make a animated GIF that loops forever:

These vectors are called *translational symmetries* of the tiling. The nice thing about symmetries is that if you perform several of them in sequence, the result must be a symmetry as well. In this case, if you have a set of vectors that are all translational symmetries, the sum of those vectors is also a symmetry.

To sprinkle in a bit of notation, let’s say you’ve got a periodic tiling, and let and be two translational symmetries of that tiling, as described above. (We’ll want to assume they’re not parallel, though that’s not strictly required.) Let and be two integers, not both zero. Then the new vector is a translational symmetry of the tiling.

OK, then, here’s the punchline: we can rotate and scale the whole tiling so that the vector is vertical and has length . That puts the tiling into a configuration where the top and bottom edges of our canonical horizontal stripe line up, meaning that we’ll get a seamless drawing under the complex exponential map!

We now have a recipe that we can apply starting from any periodic tiling together with integers and . Let’s look at some examples based on a humble tiling of squares. Unlike the previous diagrams, I’m zooming out a bit to show some of the tiling above and below the slice. The slice itself is bounded by the dashed horizontal lines. You can see that in each case I’m taking a different sum of horizontal and vertical square edges as my primary vertical repeat vector. The whole tiling is then oriented so that this sum of the two green vectors is vertical and has length . Something quite nice happens here. Consider the tiling, for example. As you walk along any vertical line in the slice, you’ll pass three grid lines parallel to and seven lines parallel to . This fact is reflected in the spiral tiling: if you look carefully, you can see three spirals of tiles in one direction and seven in another! The colourings below allow you to count them up. The pattern holds in general: a spiral square tiling based on will exhibit spiral arms in one direction and in the other.

Of course, there’s nothing here that restricts you to squares. Any periodic tiling of the plane can be combined with integers and and mapped into one of these spiral arrangements. Here are just a couple of examples; can you figure out the tiling and the values of and that were used to produce them? Note that I’m restricting myself here to simple geometric tilings, but this technique would work exactly the same on fancy Escher-like tilings with varying colours, internal details, and other artistic devices.

As I said, the idea of using the complex exponential function (AKA the antiMercator mapping) to produce drawings like these is far from new. The specific application to periodic tilings shown here isn’t new either, given that it appears in my dissertation from (gulp) more than 15 years ago. I don’t know of an earlier source for this small novelty, but I absolutely don’t think I came up with it myself. In fact, I believe it may have been the great tiling theorist Branko Grünbaum who pointed it out to me in person. I had the good fortune to interact with him while I was working on my PhD, and everything I’ve shown you here would have been immediately obvious to him.

I have one more trick up my sleeve. We can pass the spiral tiling through a different function of the complex plane called a *Möbius transformation*, a function of the form

These are beautiful and fascinating functions. I don’t want to get too deep into their mathematical properties here, so I’ll say intuitively that a Möbius transformation can *exchange a point at infinity with another point*. If I pass a tiling through one of these transformations, I can grab infinitely many tiles that are arbitrarily far away and pack them into a point that looks like the centres of the spirals you’ve already seen. Better yet, I can keep the spiral centre I’ve already got, giving me a picture with two infinities! Here are two examples, one based on squares and one based on hexagons.

Again, this isn’t a new idea. Escher experimented with it in his print Whirlpools, and others such as Jos Leys have created similar designs.

By the way, it’s very tempting to try to repeat this trick and drag a *third* infinity into the picture. Sadly, that simply doesn’t work. Can you see why?

If you’ve read this far (or even if you haven’t), now you have a chance to play with all of these ideas yourself.

Last year I released Tactile, a library for C++ and Javascript that makes it easy to write programs to manipulate and draw tilings. Part of my motivation in creating the library was that it would then be easier for me to write quick pieces of software to demonstrate or exploit ideas from tiling theory. And that’s what I’ve done here! I wrote a fun web-based editing tool that lets you draw tilings and experiment with transforming them into spirals. Tactile is based on *isohedral *tilings; happily, these are all periodic, and so they’re perfect for experimentation in spiral form.

**Click here to launch the tool in a new window**. It’s written to be usable from a touch device like a tablet (though I wouldn’t expect it to be usable on a small phone), but it will work fine with a mouse too. The many features deserve some elaboration. I explain the different controls below, using this annotated screen shot as a guide.

- There are four buttons. The “Fullscreen” button makes the spiral tiling take up the whole window. You can return to the full interface by tapping the button again. The “Animate” button moves the untransformed tiling automatically, making the spiral mapping rotate and scale. The “Help!” button brings you to this post (in case you found the tool without reading this post first). The “Save” button downloads the spiral tiling from your browser.
- This view lets you edit the shape of a single tile. Tap on a black edge to create a new vertex and drag it around. Long-press on a vertex to delete it. The grey vertices cannot be moved directly.
- Controls for the structure of the tiling. The top slider lets you choose a tiling type. There are 81 types encompassing triangles, squares, hexagons, and other base shapes. Each type uses a different number of additional sliders to control the arrangement of grey vertices on the left. Moving those sliders will change the overall configuration of the vertices.
- These two sliders are precisely the values of and discussed above, controlling the vector that will be mapped to cover the horizontal slice. You can actually set them both to zero; the program won’t crash, but it won’t draw anything.
- The regular Euclidean tiling. You can translate the tiling around by clicking and dragging, and see the effect on the spiral view. Horizontal and vertical translation map to uniform scaling and rotation, respectively.
- A view of the resulting spiral tiling. Tap on the view to switch between a regular antiMercator mapping with one infinity, and a Möbius transformed picture with two infinities.

The combination of the complex exponential function and suitable transformations of periodic tilings offers a vast playground for creating beautiful and fun spiral tilings.

Wow, this post ended up longer than I had planned. I hope the diagrams and pretty pictures helped it go down smoothly! For my part, this post and the accompanying software were at least in part a distraction from an upcoming grant deadline. Thanks for validating my brief escape from professional duties.

]]>Now, I do not have sufficient expertise in most of the science behind this work to unpack the whole article here; you might instead read the summary that appeared in *Nature*‘s “News and Views” section. My contribution relates to a few words that the journal chopped off of the end of the title due to space constraints. The original title read “…reversible assembly *and paradoxical geometry*“. The phrase “paradoxical geometry” refers to near-miss Johnson solids, a topic that I’ve studied for a long time; the “protein cage” referred to in the title is, from my point of view, a near miss realized at molecular scale (a fact that is mentioned only in passing in the News and Views summary). I helped to explain the geometry of the cage, and to some extent measure just how paradoxical it is. Here I will give a bit of background on this topic, leading up to a geometric view of the cage’s structure.

The five Platonic solids, the thirteen Archimedean solids, and the prisms and antiprisms are convex polyhedra with regular polygons as faces. But they’re not the only polyhedra with this property. For example, you can imagine a square-based pyramid that’s just tall enough that its triangular sides are equilateral. In 1966, Norman Johnson identified 92 additional convex polyhedra with regular faces, starting with the square-based pyramid; today these are known as the Johnson solids. They’re a motley crew of geometric oddities, which look as if they were assembled out of leftover parts from the Archimedeans.

In 2001, George Hart and I published a paper about polyhedra in which we included a brief mention of “near misses”: convex polyhedra with faces that are almost—but not quite—regular. We did not attempt to define near misses rigorously, merely saying that the angles were close enough that you could assemble a model from cut-out regular polygons “without noticing the discrepancy”. The paper offered these three examples:

The second and third polyhedra are easily exposed as Johnson solid impostors, by identifying vertices that could not exist in a Johnson solid. For example, the second polyhedron has a vertex surrounded by two hexagons and two triangles. A regular hexagon has an interior angle of 120°, and an equilateral triangle has an interior angle of 60°. So, if those faces were all regular, the angles around the vertex would be 60° + 60° + 120° + 120° = 360°. But that’s impossible! When you pack that much angle around a vertex, you force the faces there to lie flat, contradicting our assumption that this polyhedron is convex. The polyhedron on the left is not so easily dismissed. You need to grind through some trigonometry to prove that if the enneagons (9-sided polygons) and squares are regular, then the triangular faces are slightly isosceles and not really equilateral (I get an angle of about 63.1° at the triangle vertex nestled between two enneagons).

I’ve written about near misses elsewhere, including a 2016 post about a new one I had constructed. In 2017, Evelyn Lamb wrote a wonderful article about the more general phenomenon of near misses in mathematics, leading off with near-miss Johnson solids. She also had the good fortune to interview Norman Johnson, who noted that he stumbled on near misses while enumerating his solids, but cared about them only to the extent that he had to eliminate them from his list. Sadly, Johnson passed away shortly after the article was published.

Around the time that we wrote that 2001 paper, I found another interesting near miss, one that didn’t fit with the techniques in the paper. To construct it, start with the pentagonal icositetrahedron (PI), the dual of the more familiar (and Archimedean) snub cube. This solid is made from 24 identical shield-shape pentagonal faces:

Let’s focus on a single shield, as in the shape on the left below:

We can imagine slicing through each of the four upper corners of the shield, as suggested by the four dashed lines. If we do this correctly, the corners are truncated to create new edges that have the same length as the leftover bits of the original shape. The pointy bottom of the shield still sticks out, but by coincidence we can just about fit two more short edges into the point, as shown in the middle. The right drawing shows that these lines define a shape that bears an uncanny resemblance to a regular hendecagon (i.e., a regular 11-sided polygon).

Looked at another way, if we take a perfectly regular hendecagon and fit it by eye to the shield, we can achieve an amazingly good fit. In the diagram below, I’ve lined up the midpoints of the top edges of a shield and a regular hendecagon, and manually scaled the latter until it straddles the edges of the former. The close-up shows just how tight the fit is. You can just barely see the hendecagonal edge tilted relative to the shield edge.

As a final demonstration of the closeness of the fit, let’s compare angles in the shield and the hendecagon:

The angle *α* on the left is a property of the PI, and measures around 114.8°. The angle *β* on the right is exactly 180°⨉(7/11), or around… 114.5°. Again, an amazing coincidence, one that makes it possible to inscribe the hendecagon almost perfectly within the shield.

To complete the construction of a near miss, we can simply glue together regular hendecagons in the same pattern as the shields in the PI. The holes around the tops of shields can easily be filled with equilateral triangles, and the holes around the pointy corners of shields can be filled with clusters of four triangles around a square. Here’s the result:

The paper model on the right is actually easiest to construct, because you can let the laws of physics absorb and distribute the mathematical error inherent in the construction. To build a computer model, you must make explicit decisions about where that error should go. For example, the faces could be made slightly irregular, or slightly non-planar.

Again, I have no rigorous test for near-miss-ness that I could apply to this solid. But intuitively, the miss is very near indeed, and the paper model can easily be constructed without noticing the error.

As an aside, my goal at the time was to create interesting tilings of the sphere to serve as a scaffolding for drawing spherical Islamic geometric patterns. I eventually created a few 3D designs based on the techniques in the paper, and on the hendecagonal near miss. I then turned these models into 3D printed sculptures.

However, I didn’t have much else to say on the mathematics of near misses, so I put the shape on a short web page and left it at that.

Fast forward to late 2013. A team of biochemists had been working with a custom-engineered protein ring called TRAP, which they knew had 11-fold rotational symmetry. They observed that under suitable encouragement from gold nanoparticles, a set of TRAP rings would assemble into a round solid form, which they called a TRAP Cage. But the structure of this cage was something of a mystery, because they didn’t know of a simple geometric form made from pieces with 11-fold symmetry. I assume they searched the web for polyhedra with hendecagonal faces, because they eventually found me by chance. And sure enough, it looked like the TRAP rings in their cage were arranged like the hendecagons in my near miss!

I joined the collaboration, with the aim of building a computational model of the TRAP Cage, from which we could measure the likelihood that the cage could hold itself together based on the distribution of error in the model.

The TRAP Cage is a bit more flexible than the near miss. First, it is constructed purely from TRAP rings, so we don’t have to worry about fitting squares and triangles into the model. Second, the rings aren’t actually attached directly to each other as they would be in a polyhedron; instead, the ring has 11 tiny arms that stick out, and arms from neighbouring rings grab on to gold atoms to hold the structure together. This extra flexibility means that we can likely construct a model cage with even lower error than the original near miss.

I tested this hypothesis using numerical optimization, searching for a symmetric arrangement of TRAP rings for which the gold bonds would have the correct lengths predicted by chemical considerations. The goal of the optimization was to minimize the worst error in bond length, while also trying to keep the arrangement of TRAP rings as round as possible.

This optimization was easily able to find virtual cages where the bond lengths between neighbouring rings never deviated by more than *one part in a billion* from their ideal lengths. That’s an astonishing degree of nearness for a near miss. I’m not a physicist, so I can’t say exactly how near, but allow me to speculate. I’ve got to assume that this deviation is well within the chemical tolerances for atomic bonds, meaning that the TRAP Cage would hold together without ever running afoul of its own mathematical impossibility. Going further, I note that the ideal bond length was given to me with just two significant digits, suggesting that an error of one part in a billion is much smaller than our uncertainty in measuring the “true” bond length in the first place. In other words, we may as well round the error to zero in the messy real world.

The TRAP Cage is, then, a real-world near miss at molecular scale: you could build it out of regular microscopic pieces without, as I said earlier, “noticing the discrepancy”.

The article appeared in the May 16th issue of *Nature*. Even if you’re not a subscriber, they have provided a link that will allow you to read the full article. I tried to use my meagre 3D modelling skills to create a flashy image for the issue’s cover, but it didn’t pass muster. Of course, my blog is the perfect place to display the image.

I’m incredibly excited to see this curious corner of geometry find a real-world application. Perhaps this discovery will motivate me or others to establish a more rigorous theory of near misses. Indeed, Agnieszka Kowalczyk, a mathematics PhD student at Jagiellonian University, together with Bernard Piette from Durham University, are already researching other cage structures with “paradoxical geometry” and have found numerous examples (aided by the fact that these cages don’t need to be fully watertight like polyhedra). They force their polygons to join edge-to-edge but permit them to deform slightly away from regularity, and then work on measuring and minimizing that deformation. They’ll be presenting some of their initial findings at this year’s Bridges conference in Linz. I’m looking forward to seeing what else we can do with this work.

]]>As an example, Susan showed a picture of Mary Shephard’s piece “Wallpapers in Cross-Stitch”:

If you are familiar with repeating two-dimensional patterns, you will know that there are precisely 17 distinct pattern types, known as wallpaper groups. This sampler shows only 12. But as Susan pointed out in her talk, Shephard’s piece is nevertheless a complete symmetry sampler. In cross-stitch, the stitches are applied to a woven fabric (called “aida”), which has holes for stitches arranged in a square lattice. Rectangular grids are fundamental to woven cloth, and necessarily constrain the symmetries that are achievable in cross-stitch. In particular, the square grid cannot support threefold or sixfold rotations (consider, for example, that no three points in a square lattice can form an equilateral triangle), which prohibits the five wallpaper groups that include them (for the record, they are p3, p31m, p3m1, p6, and p6m in the traditional crystallographic notation).

But hang on a minute. The restriction to 12 groups follows directly from the structure of the aida, not from a mathematical law. And while it’s certainly true that almost every cloth on earth is woven using warp and weft at right angles to each other, producing a rectangular arrangement of holes, other weaves are possible. I started thinking about an article I had worked on in my past capacity as editor of Journal of Mathematics and the Arts: Paul Gailiunas’s study of the mathematical properties of mad weave:

Mad weave is *triaxial*: it’s made from threads in three evenly spaced directions. And look at the arrangement of holes left behind:

With a suitable stitching pattern, those holes would permit threefold and sixfold rotational symmetries!

Sitting in Susan’s talk, these two threads came together (so to speak). If I could find (or make) a suitable piece of triaxial cloth, I could use it as a kind of aida. Then I’d have to develop a new stitching pattern that’s as analogous as possible to traditional cross-stitch. At that point, I’d be able to create a hexagonal cross-stitch symmetry sampler. I resolved to attempt this project in time for the following year’s Bridges conference.

Obviously, the cloth would have to be very fine, so that stitches on it would be sufficiently small. I wasn’t eager to weave that myself by hand. So first, I looked into the manufacturing of woven triaxial fabrics. It turns out that they do exist. They have good engineering properties: they tend to be more isotropic than regular woven cloth (they behave similarly in every direction) and less stretchy (because they don’t shear). After a lot of exploration, I reached out to Sakase Adtech in Japan. They very generously sent me a few samples of their polyester triaxial fabrics. The weave they use is actually not the same as mad weave; it’s what Paul Gailiunas called “open hexagonal weave” in his article. But the large hexagonal holes in that weave are still in the correct arrangement:

I had never done any cross-stitching before, so I thought it would be prudent to start by creating a traditional square piece. I adapted a small piece of pixel art I had created a couple of years ago for a laptop sticker, leading to my first ever cross-stitch project:

I made a bunch of mistakes in transcribing the pattern, and you should see the horrific mess in back. But it provided a suitable introduction to the medium, enough to get working on the hexagonal piece.

I needed to develop a stitching pattern that would produce little units as similar as possible to the X that forms the units of traditional cross-stitch. After experimenting with and rejecting a few alternatives, I settled on this pattern:

Here, three individual stitches in a prescribed order (“vertical, backslash, slash”) make up an asterisk-shaped unit. The stitches begin in the six hexagonal holes surrounding another hexagon and jump over that central hole, meaning that a number of holes have no stitches in them. That’s fine, of course, if the units are small enough, and this approach turns out to be the most convenient way to work with this fabric.

It was then time to design patterns. I decided to divide the sampler into a kind of hexagonal honeycomb (to emphasize the sixfold symmetry), and I created vector drawings in Illustrator for every cell. Each drawing shows the low-level hexagonal holes of the fabric, with larger, filled-in hexagons showing the intended units:

With all those pieces in place, the last step was very simple: hours upon hours of punishing, tedious manual labour. My close-up vision has taken a sharp nosedive in the past couple of years, so here I was aided by a *very stylish* magnifying visor with built-in LED headlamp. I’m quite happy with the finished result:

There are five large hexagonal cells, containing the five symmetry groups that are not possible using traditional cross-stitch: reading in rows from the top, p31m, p3m1, p3, p6, and p6m. The other three cells are each divided into three rhombi, showing the other nine wallpaper groups that are also possible with hexagonal holes: p1, p2, pm, pg, cm, pmg, pgg, pmm, and cmm. This fabric can’t show fourfold rotations, which leaves precisely three wallpaper groups (pm, p4g, and p4m) on the sewing room floor. That makes for a grand total of 14 groups, versus 12 for traditional cross-stitch. Take that, Mary Shephard!

A pedantic mathematician will no doubt observe that the sampler doesn’t actually have all the symmetries advertised here. In each individual unit, the stitches are layered, which strictly speaking eliminates nearly all possible kinds of symmetry. Pedant, I salute you! Indeed, if you take the layering of threads into account, and require every unit to follow the vertical-backslash-slash pattern, then I think you’re able to represent only groups p1 and p2. Of course, the same layering problem arises with traditional cross stitch, and we respond with the same simplification: for the purpose of evaluating symmetry we flatten stacks of thread into conceptual blobs of colour.

Very special thanks to Ryoji Sakai and Sakase Adtech for sending me samples of their triaxial fabrics, and to Teruhisa Sugimoto for providing assistance in reaching out to them. Thanks also to Veronika Irvine for providing feedback on both the mathematical and stitching sides of this project, and to Linda Carson for suggesting the oddly shaped matte, which was expertly cut by The Artstore in Waterloo. And of course, thanks to my wife Nathalie for teaching me the basics of cross-stitch, giving me access to her large stash of supplies, and not mocking my visor too much.

]]>I was very lucky as a graduate student to fall in with an advisor who was interested in applications of computer graphics to art and design, and who allowed me a lot of leeway to explore creative topics that interested me. I ended up completing a PhD about two main topics: Islamic geometric patterns and M.C. Escher’s tessellations.

I was also extraordinarily lucky to have a few opportunities to interact with Branko Grünbaum, who was a mathematics professor at the University of Washington (and who sadly passed away just a couple of months ago). He was a brilliant geometer who, together with Geoffrey Shephard, published *Tilings and Patterns*, which to this day remains the bible of tiling theory. It was Branko who first pushed me in the direction of studying the *isohedral tilings *as part of my research on Escher. The isohedral tilings are a particular family of tilings that are in the sweet spot for computer graphics: they’re simple to define and manipulate in software, and expressive enough to represent the sorts of interlocking animal forms that Escher invented. The isohedral tilings became such an integral part of my intellectual landscape that I began to use the word as an account name online (most obviously, because it was unlikely to have been taken by anybody else), and later chose it as the name of this website.

Over the 20 years since I first began studying computation on tilings, I have been contacted numerous times by other computer scientists who were interested in similar research topics and wanted to get a copy of my source code as a starting point for their own work. I always regretfully declined, for good reason. The library I created for my PhD was a mess—I created it by stumbling blindly through the mathematical ideas I needed, not knowing how complex the final product would be. To make matters worse, the old code relied on ancient 2000-era C++ libraries that are difficult or impossible to use today. Of course, I always hoped to have an opportunity to develop a new, streamlined version of the library based on the lessons learned through this first experience.

Today I’m happy to say that I’ve come full circle on the isohedral tilings. I’ve had a bit of time over the last few months to develop a new software library that streamlines and simplifies my earlier version. During my PhD I called my software Tactile, and I’ve decided to revive that name. The new Tactile library is slick, fast, lightweight, and easy to use. It’s been quite fun to play with so far, developing small demo programs that draw tilings, like the random tiling generator in the banner at the top of this page.

The library comes in two flavours: there’s a portable C++ version simply called Tactile, which should easily compile into any application. There’s also a Javascript version called TactileJS, which should make it easy to incorporate live tilings into web-based applications. The two links above will take you to Github repositories for the two libraries. They’re both offered under the permissive 3-clause BSD license, so feel free to use them however you like! Both repositories come with short tutorials and demo programs, which is hopefully enough to get started. If not, I suppose I’ll put together more comprehensive documentation in response to requests by users. I’m also planning to write a more technical paper about the development of this library, which I hope will include some information on how to use it in programs.

If you’re not a programmer, you can still use Tactile to play with tilings, just for fun. On a separate page I offer a minimalist interactive editor for isohedral tilings (see the instructions on that page for more information). That implementation will work well on a laptop or desktop, where you can drive it with a combination of mouse and keyboard. If you want a purely touch-based experience suitable for a tablet, you can also try fancier version at tactile.isohedral.ca. I hope these are fun!

I think I can say with some confidence that one of the direct inspirations for this cup was the death of Lt. Van Mayter in the Star Trek: The Next Generation episode “In Theory” (AKA “Data gets a girlfriend”):

The result is decent. The disconnected tip of the handle doesn’t quite reach the table’s surface, probably because of imperfections in the manufacturing process (the handle might have bent a bit before firing, or it might have shrunk by a different amount than the body of the cup). The handle also doesn’t end in a sharp wedge, as one might expect, because this 3D printing process can’t print very thin surfaces. Finally, the cup is a bit large for a typical espresso. That’s partly to make it big enough that I don’t need to compromise on its shape, and partly because some of the inner volume of the cup isn’t actually usable (because it’s meant to be tilted!).

But the illusion is reasonably convincing. Or, perhaps more accurately, the concept is completely clear, so that even if you don’t *actually believe* that the cup is sinking into the table (and hey, you shouldn’t), you can at least suspend disbelief and enjoy the effect (not to mention some delicious coffee).

As always, the cup is available for purchase on Shapeways, with the caveat that it’s going to cost a lot more than a regular cup. Really, this one might be a fun candidate for mass production.

]]>The first of the two cups is inspired directly by the Moka Pot, the traditional Italian stovetop espresso maker. They almost all take the form of a kind of octagonal hourglass with a spout and a handle, an iconic shape that translates readily into a cup. In this case, I turned the top half into a small espresso cup:

There isn’t much more to say about the design—no hidden mathematical ideas or cute coding to solve design challenges. I’m reasonably happy with the design, though the flat unglazed bottom might not be to everyone’s liking. If you like the cup, it’s available on Shapeways, with the caveat that 3D printed porcelain can be a bit pricy.

Stay tuned for the second of the new cup designs.

]]>