Geometry is an entertaining branch of mathematics. Topology is, according to Clifford Pickover, the “silly putty of mathematics”. This branch of maths studies the transformation of shapes, knots and other complex geometry problems. One of the most famous topics in topology is the Möbius strip. This shape has some unusual properties which have inspired many artists, inventors, mathematicians and magicians.

You can make a Möbius strip by taking a strip of paper, giving it one twist and glue the ends together to form a loop. If you now cut this strip lengthwise in half, you don’t end-up with two separate strips, but with one long one.

The Möbius strip can also be described with the following parametric equations (where , and is the radius of the loop):

The mathematics of this set of parametric equations is not as compex as it looks. is the radius of the ring, is the polar angle of each point and indicates the width of the strip. The polar angle indicates the number of half twists. To make the ring twist twice, change the anlge to .

For my data science day job, I have to visualise some three-dimensional spaces so I thought I best learn how to do this by visualising a Möbis strip, using these three equations.

## Plotting a Möbius Strip

The RGL package provides the perfect functionality for plotting Möbius strips. This package produces interactive three-dimensional plots that you can zoom and rotate. This package has many options to change lighting, colours, shininess and so on. The code to create for plotting a Möbius strip is straightforward.

The first section defines the parameters and converts the and sequences to a mesh (from the plot3D package). This function creates two matrices with every possible combination of and which are used to calculate the points.

The last three lines define a 3D window with a white background and plot the 3D surface in blue. You can explore the figure with your mouse by zooming and rotating it. Parametric equations can be a bit of fun, play with the formula to change the shape and see what happens.

library(rgl) library(plot3D) R <- 5 u <- seq(0, 2 * pi, length.out = 100) v <- seq(-1, 1, length.out = 100) m <- mesh(u, v) u <- m$x v <- m$y ## Móbius strip parametric equations x <- (R + v/2 * cos(u /2)) * cos(u) y <- (R + v/2 * cos(u /2)) * sin(u) z <- v/2 * sin(u / 2) ## Visualise bg3d(color = "white") surface3d(x, y, z, color= "blue")

You can find the latest version of this code on GitHub.

We can take it to the next level by plotting a three-dimensional Möbius strip, or a Klein Bottle. The parametric equations for the bottle are mind boggling:

Where: and .

The code to visualise this bottle is essentially the same, just more complex equations.

u <- seq(0, pi, length.out = 100) v <- seq(0, 2 * pi, length.out = 100) m <- mesh(u, v) u <- m$x v <- m$y x <- (-2 / 15) * cos(u) * (3 * cos(v) - 30 * sin(u) + 90 * cos(u)^4 * sin(u) - 60 * cos(u)^6 * sin(u) + 5 * cos(u) * cos(v) * sin(u)) y <- (-1 / 15) * sin(u) * (3 * cos(v) - 3 * cos(u)^2 * cos(v) - 48 * cos(u)^4 * cos(v) + 48 * cos(u)^6 * cos(v) - 60 * sin(u) + 5 * cos(u) * cos(v) * sin(u) - 5 * cos(u)^3 * cos(v) * sin(u) - 80 * cos(u)^5 * cos(v) * sin(u) + 80 * cos(u)^7 * cos(v) * sin(u)) z <- (+2 / 15) * (3 + 5 * cos(u) * sin(u)) * sin(v) bg3d(color = "white") surface3d(x, y, z, color= "blue", alpha = 0.5)

The RGL package has some excellent facilities to visualise three-dimensional objects, far beyond simple strips. I am still learning and am working toward using it to visualise bathymetric surveys of water reservoirs. Möbius strips are, however, a lot more fun.

If you are interested in visualising the oddities of mathematics then feel free to peruse my article about the Sierpinsi triangle.

## Creating Real Möbius Strips

Even more fun than playing with virtual Möbius strips is to make some paper versions and start cutting, just like August Möbius did when he did his research. If you like to create a Möbius strip, you can recycle then purchase a large zipper from your local haberdashery shop, add some hook-and-loop fasteners to the ends and start playing. If you like to know more about the mathematics of the topological curiosity, then I can highly recommend Clifford Pickover’s book on the topic.

In the first half of the twentieth century, many magicians used the Möbius strip as a magic trick. The great Harry Blackstone performed it regularly in his show.

If you are interested in magic tricks and Möbius strips, including how to create a zippper version, then you can read my ebook on the Afghan bands.

## One Reply to “Topological Tomfoolery in R: Plotting a Möbius Strip”