### How to make a paper spherical panorama

Photos usually only show a rectangular fragment of the scene when the image was taken. Typical panoramic images display more of a landscape, but they still don’t capture the whole picture. Even a 360˚ panorama only captures a horizontal circle, leaving out the ground and sky.

What if you have a nice scene that you’d like to convey in full? I’ll show you how to make a spherical panorama, making use of all 4π steradians with software, a printer, and some paper.

My example is an unseasonal Christmas scene because I played with this a few months ago. Maybe we can imagine this is for a Christmas-themed celebration held in winter in the southern hemisphere.

#### Tools for creating panoramic images

The first free tool I’d recommend is Microsoft Photosynth, which generates panoramas and other immersive images and videos. You can use Photosynth on a computer or as an app on a smartphone or tablet. The iPhone app automatically snaps pictures as you aim the camera in different directions, and it stitches them into a panorama. Here is an interactive panorama I made of the inside of my house:

The second is Hugin, a free tool for the computer that gives you more freedom to construct your panorama, although it has a higher learning curve. You can import photos from any camera, and the software will stitch them together. You can also help it find matches between the photos to help it stitch better, and change settings to make the panorama as seamless as possible. You can also choose different projections, which allows you to create some interesting artistic effects. For example, one of my favorite projections is called the stereographic projection, which is employed here as in this “small world” effect reminiscent of Le Petit Prince, taken in my backyard.

#### Figuring out coordinates and projections

These tools can make a 2D representation of a scene, but we want a 3D sphere. You’re probably familiar with the problem of turning a globe into a map of the world: you have to make a projection to translate the 3D globe into the 2D map. Here we want to go in the other direction.

For this project, I prefer the equirectangular projection because it has the nice property that the horizontal coordinate is the longitude and the vertical coordinate is the latitude. This makes the mathematics of the mapping much simpler. Now the mapping to the sphere is

$$\begin{bmatrix}x\\y\\z\end{bmatrix}=\begin{bmatrix}\sin{\theta}\; \cos{\phi}\\ \sin{\theta}\;\sin{\phi}\\ \cos{\theta}\end{bmatrix},$$

where $$\theta$$ and $$\phi$$ are the standard spherical coordinates. But having these coordinates isn’t enough; I want to make a physical model of this sphere.

The solution is to mathematically find the correct shape for 10 (or some large number) of petal-shaped images, such that the spherical image can be printed on several flat pieces of paper, and then rolled together to form an approximation of a sphere. The sphere is partitioned into some number of sectors (regions with $$\phi$$ constrained between $$\frac{2\pi i}{n}$$ and $$\frac{2\pi (i+1)}{n}$$). The paper petals will then join, or form a cobordism, between these endpoints.

After plotting and subsequently printing the correct boundary function in Mathematica, here is what the petals look like when they are joined at the point that will become the zenith:

#### Building the photo sphere

Now that we have the shape planned, we can take a panoramic image and project it down to the petaled surface. You can make a full sphere panoramic image (as an equirectangular map) using the software of your choice. The height should be an even number of pixels.

Then what I did was import the photo into Mathematica and write a program to process it. If you’d like to try my Mathematica code for this, you can import this text file into Mathematica.

I decided to alternate the directions of the petals to minimize paper waste (as well as cost).

I cut out the petals, and I rolled each of them to make it easier to join them together.

I then put tape on the white surface (the inside) to hold the petals into the spherical shape. The result was two hemispheres:

Here’s the other side:

It’s beginning to look like something! Now it’s just a matter of gluing the two hemispheres together:

And it’s done!

#### Things to try

You can use fishing line to hang the sphere. When it rotates, occasionally the sphere appears to turn inside out, and it looks like you are viewing the room through a circular portal through a fisheye lens.

It would be fun to improve on this idea using less reflective paper to reduce glare, and to try to make the seam at the equator less conspicuous.

### Maximizing your earnings with money envelopes: a mathematical riddle

Here’s an interesting paradoxical puzzle told to me by my friend Bryan, known as the two envelopes problem, and my proposed resolution of it.

Suppose you are presented with two envelopes, envelope A and envelope B. One envelope contains twice the amount of money as the other, but otherwise the amounts could be anything. You are asked to choose an envelope, and you are allowed to keep all of its contents. Once you choose, you are offered the opportunity to switch. The question asks which option is better. While the answer may seem intuitive, consider this argument that gives a paradoxical result:

Call the amount of money in the envelope you selected $$a$$. If you stay with your initial choice, you are guaranteed this amount.

On the other hand, if you switch, you have a 50% chance of ending up with an envelope containing $$2a$$, and a 50% chance of getting the envelope containing $$\frac{1}{2} a$$. So your expected value by switching is $$\frac{1}{2} (\frac{1}{2} a)+\frac{1}{2} (2 a)=\frac{5}{4} a$$, which is slightly better than the expected amount you were guaranteed to find without switching.

The paradox is that this is absurd, since your initial choice was totally random to begin with, so switching cannot make any difference. What’s going on here?

#### Possible objection

Some people object to this riddle, saying that it is unfair to use $$a$$ for two distinct possibilities — the larger value and the smaller value. They argue that this is the source of the paradox, and believe they have solved it.

However, this argument doesn’t work. If we wanted to, we could open up the envelope right after you make your initial selection, and see what the enclosed value is. This is a perfectly well defined quantity, and we call it $$a$$.

They may make a counter-argument as follows:

Instead of defining $$a$$, let’s define $$s$$, a variable representing the smaller of the two values in the envelopes. Then half the time you choose $$s$$, the other half you choose $$2s$$, so your expected earnings is $$\frac{3}{2} s$$. This is the answer regardless of your initial selection, so the paradox is solved.

While the argument sketched above is correct, it doesn’t prove that there’s something wrong with considering the quantity equal to the value contained in the chosen envelope. Our goal isn’t to solve the problem with some argument, it’s to discover what is flawed with the argument we started with. That is the paradox.

It’s easy to convince yourself that the problem is flawed in some fundamental way, but I think it’s worthwhile to think about this problem, because in thinking about these things, it gives us a better intuition for how to solve problems like it in the future.

#### Analysis

The following is my analysis of this problem, along with a resolution.

To be totally general, suppose we generate the envelope distribution by first selecting the lower-valued (or small) envelope from a known distribution $$\rho(x)$$. We will make the simplifying assumption that money is continuous in the sense that it is infinitely divisible (we even allow for fractional pennies). For every one of these “small” envelopes in our sample space, there is exactly one envelope which contains twice the value. These envelope pairs are always drawn together. Then if we happen to know we have chosen the smaller envelope, we have

$$p\left(a=x\;\big|\;s\right)=\rho(x)$$,

Where the notation on the left side means “Probability that the chosen envelope value is $$x$$, given that the smaller envelope has been chosen (s for ‘small’)”.

Similarly, if we know we have chosen the larger envelope, then we know we have sampled a distribution scaled up by a factor of 2. After scaling and properly normalizing the distribution, we have

$$p\left(a=x\;\big|\;b\right)=\frac{1}{2}\rho(\frac{x}{2})$$,

where again, the $$b$$ means you have chosen the larger of the two envelopes (b for ‘big’).

Then it follows that if we know nothing about which envelope we picked, the probability distribution is

$$p\left(a=x\right)=\frac{\rho(x)+\frac{1}{2}\rho(\frac{x}{2})}{2}$$.

The following graph shows an example probability distribution for the amount found given the small envelope is chosen (orange) and the large envelope is chosen (red).

Then we can compute our expected earnings by sticking with our first choice:

$$\displaystyle\int_0^\infty x \frac{\rho(x)+\frac{1}{2}\rho(\frac{x}{2})}{2} \; dx = \displaystyle\int_0^\infty x\;\rho(x)\; dx (\frac{1}{2}+\frac{1}{2}\cdot 2)=\boxed{\frac{3}{2} \left<x\right>_\rho}$$.

This is the result we know must be correct whether we switch or not. But now it’s time to see if applying the reasoning from the original paradox still follows. What happens if we switch instead of staying with our original choice?

Now for any value of $$a$$, there are two possibilities. We could have the smaller envelope, or we could have the larger envelope. But what are the chances that we chose the smaller envelope given $$a=x$$? Conversely, what are the chances we got the larger envelope given $$a=x$$? For this, we need Bayes’ Law:

$$P\left(A\big| B\right)=\frac{P(B| A) P(A)}{P(B)}$$.

This works just as well for distributions as it does for absolute probabilities, or in our case, both at the same time. Using this format, we have

$$P\left(s\;\big|\;a=x\right)=\frac{\rho(x) \cdot \frac{1}{2}}{\frac{1}{2}(\rho(x)+\frac{1}{2}\rho(\frac{x}{2}))}=\frac{\rho(x)}{\rho(x)+\frac{1}{2} \rho(\frac{x}{2})}$$,

and

$$P\left(b\;\big|\;a=x\right)=\frac{2 \rho(\frac{x}{2}) \cdot \frac{1}{2}}{\frac{1}{2}(\rho(x)+\frac{1}{2}\rho(\frac{x}{2}))}=\frac{\frac{1}{2}\rho(\frac{x}{2})}{\rho(x)+\frac{1}{2} \rho(\frac{x}{2})}$$.

Then, to compute your expected earnings by switching, we compute

$$\displaystyle\int_0^\infty \underbrace{\frac{\rho(x)+\frac{1}{2}\rho(\frac{x}{2})}{2}}_{\text{Initially chose x}}\ \left[\frac{1}{2} x \underbrace{\frac{2 \rho(\frac{x}{2})}{\rho(x)+\frac{1}{2}\rho(\frac{x}{2})}}_{\text{Initially chose big given x}}+2x \underbrace{\frac{\rho(x)}{\rho(x)+\frac{1}{2}\rho(\frac{x}{2})}}_{\text{Initially chose small given x}}\right]\; dx$$.

Luckily, the messy numerator of the first factor cancels with the denominator of both terms in the square brackets. This leaves us with

$$\displaystyle\int_0^\infty \frac{1}{2} \left[\frac{1}{2}\cdot x\cdot 2\;\rho(\frac{x}{2}) \cdot \frac{1}{2}+2x\cdot\rho(x) \cdot \frac{1}{2}\right]\; dx$$.

We can substitute $$x\rightarrow 2x$$ to make the integrand have only $$\rho(x)$$, which gives

$$\displaystyle\int_0^\infty x \rho(x) (\frac{1}{2}+1)\; dx =\boxed{\frac{3}{2} \left<x\right>_\rho}$$.

So in this analysis, we obtain the same answer by switching, as our intuition tells us.

#### The paradox revisited

You may not feel very satisfied about this, because even though we took the same route as the original paradox (but being more careful about conditional probabilities), we haven’t exactly put our finger on what is wrong with the initial argument.

In the original formulation, we made an assumption that the probability of choosing the larger (or smaller) envelope does not depend on the value of $$a$$. Is this valid? It seems valid, since we assume that the probability distributions are uniform — that is, you are just as likely to have chosen any positive real amount of money. But this is precisely the problem. If we are assuming every amount of money is equally likely, this is an impossible distribution — but even if we pretend that such a distribution makes sense, there is no bound on how large a bounty can be concealed in the envelopes! Your expected earnings would already be infinite — and infinity times $$\frac{5}{4}$$ is still infinite! Even in this unrealistic example there would be no paradox — the only paradox is that we are thinking of a problem where we expect to receive an unphysical amount of money.

Now consider the modification I made — I forced a probability distribution to make things more realistic. For any physically viable distribution, there must come a point where the distribution begins to drop off. For the sake of argument, suppose that change happens very abruptly: a positive probability of finding an amount smaller than a threshold $$t$$, but zero probability density of finding any amount larger than $$t$$ (in the diagram, this drop-off happens between 2 and 3). Now suppose that you pick an envelope, and it happens to have an amount greater than $$t$$ (for instance, a value of 4 in the diagram). Now there is no chance that you have chosen the smaller of the two envelopes— after all, the probability of picking such a value given we have chosen the smaller envelope is zero!

This is where the 50-50 assumption breaks down in reality. The amazing fact is that the resolution to the paradox comes from the realization that we were making an incorrect assumption about the distribution of monetary amounts being uniform all the way to infinity.

### Playing detective with rolling shutter photos

A while back, my friend Britta sent me an interesting photo she took with her iPhone while on a trip in a turboprop plane. The photo looked similar to this one, with a strange view of the propellors due to the “rolling shutter” effect of the CMOS sensor in the iPhone camera.

This effect piqued my curiosity. Can we figure out the rate at which a propellor is spinning by analyzing this kind of photo? And can we figure out the real number of propellor blades in the photo? (You can scroll to the end for answers if you’re impatient!)

#### Learning more about the iPhone camera’s properties

To start my research, I found this example of rolling shutter effect in video, showing strings vibrating at known frequencies (musical notes):

The yellow arrow represents the width in pixels of the image, which I measured to be about 393 px (when full size). The red arrow represents the width in pixels of the “wavelength” of the wave, which is measured to be about 171 px (when full size). This length actually reflects a temporal wave more than it does a spatial one, as in the small circular opening of the guitar, the string practically vibrates up and down remaining horizontal. A low E string on a guitar is supposed to be about 82 Hz, but I measured it with Audacity to be closer to 81 Hz. Then since the wavelength (red) represents the number of pixels sweeped out by the rolling shutter in one period of the E string, we can compute the shutter sweep time (professionally called the readout time) of the front-facing camera in the iPhone 4.

$$(1/81\mbox{Hz}) /\frac{817-646}{934-541}\approx \boxed{28\mbox{ ms}.}$$

#### Describing the rolling shutter effect

Now we can explore what’s happening in the propellor image above. Let’s say the propellor is rotating (counterclockwise), and the shutter is rolling from left to right. We can look at what will happen on the top and bottom halves of the propellor separately. On the top side, the blades are moving toward the rolling shutter, so there will be a larger relative velocity between the two, and therefore more “collisions” between the shutter and the blades. This will result in a larger-than-normal blade count. On the other hand, the bottom of the propellor will be moving in the same direction as the rolling shutter, and thus the relative velocity is smaller. This results in fewer blades, and each blade (and the space between them) will be stretched out.

There is a subtlety here: the velocity of the blades is not uniform with respect to radius. This means that points toward the center of rotation have less velocity, and so the rolling shutter effect is less noticable there. In fact, on the lower side, there is a point at which the blade’s velocity matches the sweep rate. Something very special happens here, and we will examine this in detail later. Therefore we expect the propellor to look normal within some (possibly small) neighborhood of the axis, but at some point on the bottom a critical point is reached where the tangential velocity matches the sweep velocity. Below that point, the relative velocity becomes greater again, but in the opposite direction, so we can expect that text written on the blades would appear in reverse.

#### Coming up with a theoretical framework

To help illustrate this effect, let’s come up with a theoretical framework. Consider a unit disk, spinning about its center at angular velocity $$\omega$$. We may draw radial blades on this disk to give the appearance of propellors. We may now consider a vertical line that sweeps from left to right at a constant rate $$v$$. We will define $$s=\frac{v}{\omega}$$. This is a satisfactory approach, since for any propellor, we may use a distance unit equal to the radius of the propellor, at which point $$s$$ is defined unambiguously as a unitless parameter. In the following animations, I have animated what a 5-blade propellor would look like for various parameters of $$s$$. These animations are made by a mathematical function written with standard functions in Mathematica via a time-dependent DensityPlot (function from $$\mathbb{R}^2\times [0,2\pi)\rightarrow \mathbb{R}$$). There are easier ways to do this, but I wanted to come up with a single mathematical function that would capture all the magic of the rolling shutter. The animation illustrates what a video of the propellor would look like, and also helps visualize what’s going on between the blades. If the video aspect seems confusing, you can also interpret these animations as showing how the pattern changes as the initial angle of the propellor (when the photo started to be taken) changes.

(s=10) Shutter rolls so quickly that the 5 blades of the propellor appear normal. This is within the intended regime of the camera:

(s=2) Blade arrangement still topologically correct, but geometrically stretched on the bottom, and compressed toward the top:

(s=1) The topological threshold. Beyond this point objects begin to tear:

(s=0.8) Past the topological threshold, we begin to see the bottom side of the blade moving in the “wrong” direction:

(s=0.3) All hell breaks loose. We can see the critical point is quite visible just under the center of rotation. Blades seem to join and be torn apart from this point. Propellors appear on one side (at about 4 o’clock), and disappear on the other side (at about eight o’clock).

(s=0.1) An extreme example where the critical point is not resolvable due to the centeral hub. Blades begin to look like planar waves moving from the right to the left:

#### Examining the motion of the blades

How can we examine the apparent motion of the blades in these animations? I will do this by quantifying the apparent velocity field of the blades in the above animations. What we can do first is define a function whose gradient results in the velocity field of the unwarped propellor. Since the velocity is always tangential, we want a function proportional to $$\theta$$. This function is not continuous in the transition from $$\theta=2\pi$$ to $$\theta=0$$. This is of no concern to us because it is the gradient, in the end, that matters, and the gap can be filled in by continuity. Now we can suppose that we paint blades in angular wedges, delineating where each blade begins and ends. As in the animations above, by warping this image, we can see how the blades bend, and the direction perpendicular to the edges of the blades will be the apparent velocity of the “blade front”.

Define

$$\Phi(r,\theta)=\theta$$.

The value of this function determines the angle of a point, but also the difference in function values between two angles tells us how much time it takes for the propeller to turn by this angle (times some angular speed which here I assume to be unity). We can deduce the velocity of the propeller by recognizing that the direction of the velocity is in the direction of the gradient of the function, while its magnitude is the distance between points divided by the time, which is actually the reciprocal of the magnitude of the gradient (since the gradient is the change in $$\Phi$$=time per change in distance).

Now consider the composition of this function with the coordinate map

$$(r,\theta)\rightarrow(r,\theta-\frac{r}{s}\cos\theta)$$.

The purpose of this map captures the fact that the horizontal position of the pixel in question determines how much later the pixel is being recorded from the “expected” time. Later in time means we must sample from a further clockwise angle, which seems strange at first, but makes sense if you think about it.

So the warped function becomes

$$\Phi’=\theta-\frac{r}{s}\cos\theta$$,

The blade now looks warped, but we still perceive velocity as

$$\vec{\nabla}\Phi’=\frac{\partial}{\partial r}\left[\theta-\frac{r}{s}\cos\theta\right] \hat{r}+\frac{\partial}{\partial \theta}\left[\theta-\frac{r}{s}\cos\theta\right] \hat{\theta}=\frac{-\cos\theta}{s}\hat{r}+(\frac{1}{r}+\frac{\sin\theta}{s})\hat{\theta}$$.

Sort of. While the gradient points in the correct direction, as the blade moves faster, the magnitude of the gradient becomes smaller. This is what I was explaining before about reciprocating the magnitude of the vectors to get the correct velocity. First let us convert to cartesian coordinates:

$$\vec{\nabla}\Phi’=-\frac{x^2+ys+y^2}{s(x^2+y^2)}\hat{x}+\frac{x}{s^2+y^2}\hat{y}$$,

and then divide by the norm squared to account for this subtlety, giving

$$\boxed{\vec{v}(x,y)=\left\{\frac{-s(x^2+sy+y^2)}{x^2+(s+y)^2},\frac{s^2 x}{x^2+(s+y)^2}\right\}}$$.

Here is a visualization of the vector field for s=0.5:

Let’s do some analysis on this flow. Let us find the stationary points by setting the components equal to zero. The second component forces $$x=0$$, which forces $$y^2+sy=0\implies y=0 \mbox{ or } y=-s$$. This means $$y=0$$ remains the center of rotation, and $$y=-s$$ is the “critical point” that we had been discussing earlier. This is the point at which the blades seem to collide and tear. You can see from the plot that the point is a “saddle point”, which explains why along one axis the blades crash together, while on another they rip apart. This is not a surprise, as we already decided this is the point where the tangential velocity of the blades equals the velocity of the rolling shutter, so $$v=\omega r=\omega s \implies r=s$$, and clearly it has to be along $$x=0$$ below the x-axis. Another interesting insight is where the broken shards of propellor appear and disappear, on the edges of the disk the propellor traces out. By reverting to our polar coordinate representation, we can rephrase the question as asking “at what point is the velocity completely radial?” This is accomplished by setting the $$\theta$$ component to zero:

$$\left. 1+\frac{r}{s} \sin\theta\;\right|_{r=r_0}=0 \implies \boxed{\theta=-\sin^{-1}\frac{s}{r_0}}$$,

which is a cool result because it means that the blade entrance, exit, and critical points are collinear, on a horizontal line.

#### Using this information to find answers

Now back to the original question: how you can forensically determine information about a rapidly spinning blade by taking a photograph with a CMOS camera? For example:

• How many blades does the propellor actually have?
• At what rate is the propellor spinning?

First question: How many blades does the propellor actually have?

If the propellor is spinning slowly enough, then the warping is minimal, so the blades can be counted normally. However, when $$s$$ becomes less than the radius of the propellor, it is somewhat more difficult to understand what is going on. However, often this does not matter, because as long as the critical point is lower than the hub of the propellor, you can count the blades as they come out of the hub, which will give the right answer.

The problem arises when the critical point is within the hub. Here is a solution to that problem: count the upward-pointing blades, and subtract from that the number of downward-pointing blades. I’m using “upward” and downward loosely, as in some cases these blades may not literally be pointing in the direction I’m describing, but it’s the kind of thing you just have to get a feel for. This method works because the “upward-pointing” blades include true blades as well as fake blades. But fake blades, unlike real blades, extend downward, and therefore can be subtracted away. Here is an example using the “subtracted away” approach:

There are 9 blades on the top, and 4 on the bottom, giving (\9-4=5\), so five blades. Another way to see it is the red regions show the fake propellor blades that will be subtracted away, also indicating that there are five blades present on this propellor. This technique becomes much more useful when counting fast-spinning propellors. Aesthetically, this method is very similar to the Divergence Theorem, or Gauss’ Law in Electrostatics. Whatever goes out that does not come in is attributable to a source, which in this case is the collection of blades emanating from the hub of the propellor.

Second question: At what rate is the propellor spinning?

Suppose we are at the airport and we see a propellor and we are curious to its speed, but all we have is our CMOS camera. How can we determine the rotational speed of the propellor?

For the sake of argument, suppose the propellor spans across the entire width of the camera’s image sensor. First we determine the true number of blades using the method described above. Call this number $$n$$. Now what we will do is count the number of blades from the appearing point to the vanishing point around the top (direction of larger number of blades). Call this number $$N$$. Then $$N$$ is $$n$$ times larger than the number of times one particular blade passes by the rolling shutter. In this time, the shutter point has moved from the left side to the right side of the image, which means $$N/n$$ is one half rotation larger than the true number of rotations (if you count to the appearing and vanishing points, it is slightly more than $$\frac{1}{2}$$more, but in practice this difference is usually negligible. If you’re concerned, you can count blades across the entire horizontal diameter). Therefore,

$$\mbox{# of rotations}=\frac{N}{n}-\frac{1}{2}$$,

where “$$\mbox{# of rotations}$$” (abbreviated to $$\#_{rots}$$) represents the number of rotations that take place in the time the rolling shutter takes to sweep across the entire propellor region. This number can be related to $$s$$.

$$s=\frac{\small\mbox{rolling shutter velocity}}{\omega}=\frac{2r/\small\mbox{time}}{2\pi \;\#_{rots}/\small\mbox{time}}=\frac{r}{\pi \;\#_{rots}}$$.

### Weaving sounds to make braids

Vi Hart’s “Doodle Music” video is a beautiful combination of art, math and music, illustrating parallels between symmetries in curves and symmetries in sound:

I particularly enjoyed the braid melody at 2:35, so it made me want to discover a mathematical function governing the vibrations in the air that define a “musical braid”.

#### Looking at the braid

First, let’s investigate what Vi’s musical braid looks like. If we look at a section of the spectrogram of the melody, here is what we get:

Even with this visualization, it is not obvious where the braid is. But Vi’s voice is luckily not a pure sine tone, meaning that there are many harmonics visible. Vi also chose to quantize the braid by discretely changing the pitch of her voice to make the result sound more musical, sticking to western musical tones. A pure sine tone usually does not sound very pleasing, and graphically looks like a flat line in the spectrogram; it appears similar to a the spectrogram of a whistle. To mathematically reproduce Vi’s musical braid so that it appears in the spectrogram, we need three independent sine tones, whose frequency varies in accordance with the drawing she made with sharpies.

#### Making the first thread of the braid

To mathematically “draw” Vi’s braid, we need to determine how to construct each thread individually, and then add them together at the end after erasing the parts that pass behind other threads. Let’s say that the shape of each thread is a sine wave. Then we need to create a frequency modulated signal, that is, a sine wave that changes pitch in a sinusoidal manner. A pure tone at a frequency $$f$$ can be generated as $$y(t)=A \sin(2 \pi f t+\phi),$$ where $$t$$ is in seconds, and $$\phi$$ is the phase. In our case, we need the frequency itself to change as a function of time, in particular, we want our frequency to be $$f(t)=\bar{f}+\tilde{f}\sin(2\pi g t),$$

where

$$\bar{f}=\frac{f_\mbox{max}+f_\mbox{min}}{2},\;\tilde{f}=\frac{f_\mbox{max}-f_\mbox{min}}{2}$$

It may be tempting to plug this result for $$f(t)$$directly into our pure sine formula, but this doesn’t quite work. To see this, imagine our answer is $$y(t)=A \sin(a(t))$$, with $$a(t)$$ some function to be determined. Recognize that in order for our frequency modulated signal to be locally identical to a pure sine wave with some phase, we require that the argument of the pure sine, $$2 \pi f t+\phi$$, be the best approximation to the argument of our frequency modulated signal, that is, the tangent line. So we require that the slope of the tangent line ($$a’(t)$$) be equal to our desired frequency ($$f(t)$$), indicating that our undetermined function $$a(t)$$ is essentially just the indefinite integral of our desired frequency function $$f(t)$$:

$$y(t)=A \sin\left(2\pi \int f(t) \; dt+\phi\right).$$

Let us determine $$a(t)$$:

$$a(t)=2\pi \int \bar{f}+\tilde{f}\sin(2\pi g t) \; dt=2\pi\bar{f}t-\frac{\tilde{f}\cos(2 \pi g t)}{g},$$

so our desired function is

$$A \sin\left(2\pi\bar{f}t-\frac{\tilde{f}\cos(2 \pi g t)}{g}\right).$$

This gives an output spectrogram of:

Perfect!

#### Weaving the second and third threads of the braid

Now we need two more sine waves, each offset by a different amount. Since there are $$2 \pi$$ radians in a full cycle, and we have three waves that we want to be spread out evenly, $$\phi=\{0,\frac{2\pi}{3},\frac{4\pi}{3}\}$$.

By adding several of these warbly sine tones together (call them “metasines”), we can create Vi’s musical braid. To make it look like they are passing over and under each other, we have to increase and decrease their respective volumes at the appropriate moments to give us the sense of depth. When this is done, the spectrogram looks like this:

#### The outcome

Here is the result played as a sound:

Interesting, but not as beautiful as the original. My friend Britta said it reminded her of a fire alarm.

### Creating curves with straight lines

Above is a video I recently made in response to Vi Hart’s great doodling game video. You take a curve, put dots evenly spaced (or however you want) along the line, and connect dots some predefined number apart. You can do this with any curve you want, but some results are more interesting than others. In some of the shapes, I highlighted the limiting envelope curve that is generated by the shapes. Enjoy!

And here is part of the video in gif form:

### Playing with a Flowing Torus

A friend recently sent me a video that demonstrates a remarkable slinky-like object called a toroflux, designed by Jochen Valett:

It is a long ribbon of spring metal wrapped into a coil, except instead of coiling into a helix, as most springs do, this one coils through itself. It coils again and again, for the entire extent of the ribbon, where it is finally joined to the other end, creating a single loop of metal ribbon. Because the loop is passed through itself many times, the resulting shape is non-trivial in the knot-theoretic sense; it takes the form of a torus knot.

This spring behaves in an extraordinary way when manipulated. Because the spring is under tension, and is seeking the lowest energy state possible, when it is released, it prefers to open into a torus with the largest “minor radius” possible. That is, it becomes a horn torus, where the “hole” in the doughnut vanishes.

The force responsible for this then has a tendency to “grab” onto anything placed through the hole of the torus (like a stick), and if the object has enough friction, the toroflux will have good traction. The result is remarkable; the toroflux begins spinning, while simultaneously falling, creating the illusion of a silver bubble-like structure.

I was so excited by this that I had to purchase one for myself. If I had a ribbon of spring metal, I would have wanted to make my own, but unfortunately I couldn’t find anything that would suffice. Before it arrived, I made predictions about how such an object could work, and I have enjoyed playing with it. I would like to explain here how the toroflux works using an informal analogy, hopefully making it understandable.

#### Capturing the idea of “rolling” down

Let’s say we want to build a device that rolls down a vertical rope. When we think of rolling, the first thing that comes to mind is wheels. So we could accomplish the task by placing a number of vertical bicycle wheels radially in contact with the rope, each wheel connected to its neighbor via some framework. Here I have pictured two wheels for simplicity, but the principle could be generalized to many wheels. Provided that the device doesn’t slip off, and traction is maintained between the wheels and the rope, the assembly will fall, and the wheels will simultaneously turn as indicated by the blue arrows (relative to the falling frame).

This allows our apparatus to roll down straight. But what if we want the device to spin like the toroflux does? Well, just like when driving a car, you can guide a wheeled device in a certain direction by turning the wheels. In our case, we want the device to begin rotating. What would happen if we took these wheels and rotated the axis of each wheel some fixed angle about the radial direction? The adjacent diagram illustrates this with a top-down view of the wheel system, with the rope in cross-section. As the wheels “drive” down the rope, they have no choice but to make the whole assembly spin because of the way they are angled.

Now we have something that is much more similar to the toroflux. It not only rolls down a rope, but the whole system also rotates about the axis of the rope as it does so. The ratio of the downward velocity and the rotational velocity is determined by the angle of the wheels.

#### Doing away with the chassis

We now have a number of wheels held together by the support struts and also held tight to the rope with spring mechanisms to maintain traction. The support chassis is necessary for a simple reason: the wheels are not connected to one another. In the topological sense, the set of wheels is comprised of more than one connected component. We can rid ourselves of the chassis if we create a single wheel that locally (relative to the rope) looks identical to the wheels. That is, the rope should be unable to tell the difference between many tires touching it and a single, serpentine tire touching it and curving inward toward the rope in exactly the same way that the individual wheels did.

Here is a way to accomplish this. If you follow the curvature of a wheel, instead of curving around in a circle and reconnecting directly with itself, it must arc over toward the next wheel and join with it! This wheel will also do the same thing with its other neighbor, and this continues all the way around until we have only one spiraling wheel, all one piece. This does not interfere with the rolling of the wheels, because all the wheels spin in the same direction, so the “excess” tread from one wheel goes into the tread that is moving away on the neighboring wheel. Thus the physical result is essentially the same. (This forms a torus “knot” classified by {1,n}, signifying that in a single rotation around the rope, the coils spiral n times.) The above animation shows how the separate wheels are deformed and connected to each other to form a single coil-tire.

This is all fine and good, but we still require a great amount of tension in the spring to keep it pressed firmly enough on the rope to prevent slipping. As the device rotates faster, centrifugal force will pull the spring-tire apart, and it will begin to lose traction with the rope. We will see in the next section how to prevent this from happening.

#### Using centrifugal force to our advantage

Our device runs into some trouble when it starts spinning really fast. As the device spins, the coils pull apart and lose traction with the rope. We can put the coils under more tension, but there are practical limitations. There is a much more clever way to solve this problem, and it involves using centrifugal force against itself to achieve what we are looking for.

Instead of running the coil in the way I described earlier (as a {1,n} torus), we can loop the torus through itself, so that each coil wraps around the other side of the rope, so when the toroflux begins spinning rapidly, centrifugal force only pulls it tighter around the rope. In this way, we form a {n-1,n} knot, which is a true knot, so that upon orbiting the rope n-1 times, the coil winds n times. This knot resembles but is not actually equivalent to a single torus of circles of the Hopf fibration.

Hopefully this explanation makes clear how the toroflux works, and also helps illuminate the ingenuity and utter elegance of this invention. I also made a video to demonstrate it: