By Peter Prevos
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 to play with virtual 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.
# Moebius strip library(rgl) library(plot3D) # Define Parameters R
You can find the latest version of this code on GitHub.
Plotting a Möbius Strip: RGL output.
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.
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.
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.
The Möbius Strip in Magic
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, then you can read my ebook on the Afghan bands.
The post Topological Tomfoolery in R: Plotting a Möbius Strip appeared first on The Devil is in the Data.
To leave a comment for the author, please follow the link and comment on their blog: The Devil is in the Data.
R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...
Source:: R News