Saturday, 16 September 2017

Extreme High-Speed Dreidel Physics

(Warning: if you're viewing this post on a phone with limited should probably leave before all the gifs load)

Every November or December, Jews around the world celebrate Hanukkah, a holiday that commemorates defeating and driving out the Hellenistic Seleucids from Israel and establishing the short-lived Hasmonean kingdom* around the year 160 BC. The celebration of Hanukkah involves lighting candles, eating greasy food, exchanging gifts, re-telling the story, and playing games with a spinning dreidel.

Legend has it that when the study of Judaism was banned by the Seleucids, scholars took to the hills to study in secret, and when authorities came to investigate, they pretended they were just doing some good wholesome gambling. That legend, however, is very likely made up and doesn't appear in print before 1890. I read an article arguing that the dreidel originated from a popular gambling device called a teetotum that was popular in Northern Europe in the medieval period, that eventually made its way into Yiddish culture. The letters on the four sides of the dreidel (equivalent to N, G, H Sh) are interpreted to stand for the Hebrew "Nes Gadol Haya Sham" (a great miracle happened there), but originally stood for the Yiddish rules for gambling with a dreidel: nit (nothing), gants (everything) halb (half), and shtel ein (put one in)**.

From a physics perspective, a dreidel is an example of a spinning top, a source of extremely difficult homework problems in undergraduate classical mechanics related to torque and angular momentum and rigid body motion and whatnot. I was chatting with a theorist I know who mentioned that it would be fun to calculate some of these spinning-top phenomena for the dreidel's specific geometry (essentially a square prism with a hyperboloid or paraboloid base), and I suggested trying to compare it to high-speed footage. A quick literature review revealed that most of the dreidel analysis has to do with whether the gambling game is fair and how long the games last. Annoyingly, the search was obfuscated by the fact that there's a publisher called DReidel.

My lab has a high-speed camera that is used to film gel particles and droplets as they deform. It is normally connected to a microscope, but with the help of a student in my lab, we removed it and connected it to a macroscopic lens we had lying around in ye-olde-drawer-of-optics-crappe. A representative of MIT Hillel graciously provided me with a few dreidels, and I some time spinning the dreidels in front of the high-speed camera and recording them at 1000 frames per second.

Before I get into the more quantitative analysis, let's just take a look at what a dreidel looks like in slow motion, because as far as I can tell from a the google, I am the first person to attempt this.

As I initially spin the dreidel, it spins in the air a few times, lands with an axial tilt, and gradually rights itself as its angle of precession comes closer to the vertical. After that, you can see it spinning rapidly and precessing a little bit, but not doing anything too crazy.

The self-righting behaviour is a lot more extreme when I do the advanced-level upside-down flip.

On those first few bounces, it really looks like it's going to fly out of control and crash, but still it gradually rights itself into a stable rotation. While this self-righting tendency is is not unstoppable.

It's also pretty fun to watch what happens when they eventually lose stability and fall over.

This self-righting is too complicated-looking for me to understand right now, so let's look at something simpler: the steady-state (a) rotation and (b) precession.

It rotates several times while precessing from left to right.

To perform quantitative analysis of the dreidel's motion, I would want to be able the measure the phase of its rotation over time. Because the dreidel is made of reflective plastic, as it spins it reflects light into the camera, moreso when its face is parallel to the plane of the camera. Thus by measuring the total intensity, we should have a proxy for the phase of the dreidel, each intensity peak being a quarter-turn, and can investigate how that evolves over time. I wrote a MATLAB script that summed the total intensity of each frame and plot it over time.

There was initially a problem with this method of analysis, however. You can figure it out if look at the wall behind the dreidel in the above gifs (especially the wide crashing one), and notice that it's flickering. This is because the room is illuminated with AC electric light with a 60 Hz frequency. The light intensity is proportional to the square of the current, so it has a maximum twice per cycle, and the light flickers at 120 Hz. That is exactly the frequency at which the intensity fluctuates; the flickering was swamping the contribution from the dreidel. However, the quarter-turn frequency isn't that far off, so I was getting some neat beat frequency dynamics as well***.

This caught me off guard and it was skewing all my videos, so I took another few recordings using my cell phone flashlight with all the AC lights turned off. The videos don't look nearly as good, but the time-series are cleaner.

We can the intensity fluctuating periodically every ~8 ms, corresponding to a rotation period of 32 ms (nicely close to the square root of 1000, so it's also around 32 rotations per second), and a slower mode of about 200 ms or 5 precessions per second. 32 rotations per seconds is 128 quarter-rotations per second, so you can figure out why it took me a while to figure out that I had to disentangle it from the 120 Hz light flickering.

The fourier transform shows two peaks, one corresponding to rotation and one to precession, which is of stronger amplitude (I believe this is due to my analysis method and not to actual physics). The reason the peaks are smeared and not as at a sharp frequency is because the angular velocity gradually decreases as the dreidel loses energy to friction, so the peaks get smeared to the right.

With the flickering out of the way, I can also calculate how the rotation period evolves over time, using a peak-finding function in MATLAB. It gradually gets slower, as expected, which 6-7 ms between peaks at the beginning, and 14 ms between the peaks before it crashes. If this is caused by dry friction at the base, we would expect the frequency to decrease linearly with time. If it's caused by viscous drag, we would expect an exponential decrease. What do we see? The fact that it's discretized by the frame rate makes it harder to tell, but applying a rolling average on the frequency decrease suggests that it is linear and thus caused by dry friction.

The measurement gets a bit hairy towards the end.

That was mostly a discussion of the rotation, although precession presented itself as well. Let's take a closer look the precession. I wanted to measure the angle the dreidel was at with respect to the vertical, and how that evolved over time. This is not as easy to measure as the total image intensity; I had to use Principal Components Analysis. I found an algorithm on this blog post, and it worked as follows:

  1. Define a threshold intensity such that everything in the image above the threshold is dreidel, and everything below it is background. Set the dreidel equal to 1 and the background equal to 0.
  2. Define two arrays, one containing all the x-coordinates of all the 1's, and the other containing all the y-coordinates of all the 1's (such that each 1-pixel is represented in the array).
  3. Calculate the 2x2 covariance matrix of the location array.
  4. Find the eigenvectors and eigenvalues of the covariance matrix.
  5. Find the angle associated with the eigenvector with the larger eigenvalue (e.g. the arctangent of the ratio of its components)
With some finagling to get the angle in the correct quadrant (I wanted the angle from the vertical, not from the horizontal), this works pretty robustly. It works better if I crop the movie to only include the stem. This actually only measures the angle of the dreidel projected onto the plane of the camera and doesn't provide information about its tilt towards or away from the camera, but it's good enough to see how the precession angle evolves. I can examine how the angle evolves over time...and it's pretty neat.

Two things are apparent from looking at this graph: both the amplitude and frequency of precession are increasing over time. The fourier spectrum of the precession angle contains only the precession peak, without the rotation peak at higher frequency. What's happening is that gravity is exerting a torque on the dreidel at an angle relative to its principal angular momentum vector, which induces a precession in the direction determined by the cross product of spin and down. The angular frequency of precession is inversely proportional to that of rotation, so that as the dreidel slows due to friction, its precession speeds up, which is what we see. The spinning is essentially preventing the gravitational torque from pulling the dreidel down, and as it loses angular velocity, the precession angle gradually increases.

This whole project started as a discussion with a colleague about how the term "Jewish physics" should be repurposed from a label the Nazis used to discredit Einstein, and dreidels seemed like a natural thing to focus on. After fiddling around with a high-speed camera for a bit I got some cool videos, and thought I'd share them. I didn't really cover anything in this post that isn't explained in great detail in dozens of analytical mechanics textbooks, but it's perhaps the first time anyone has used a high-speed camera to record a dreidel. I thought it was neat.

In addition to being a fun little diversion, it also spurned an improvement in my DNA image analysis code. It was taking so long to open the dreidel movies in MATLAB that I looked into a more efficient way of doing so, which improved loading time by like a factor of 20 (from 55 seconds down to 3 seconds), which I now use to open DNA movies as well.

*If you grew up hearing the Hannukah story every year, you probably will not recognize the words Hellenistic, Seleucid, or Hasmonean.

**For those unfamiliar with Jewish linguistics, Hebrew is a Semitic language related to Arabic and Ethiopian (Amharic), whereas Yiddish is a Germanic language that uses Hebrew letters, so some of the words are similar to the also-Germanic English, e.g. halb and half.

***This is what the FAKE NEWS wrong analysis looks like:

Thursday, 23 February 2017

Comfortable Relativistic Space Travel: New paper on arXiv

I have written a new paper which has just come out on It has the somewhat long title of  "Relativistic minimization with constraints: A smooth trip to Alpha Centauri" and can be found here. My co-author on this paper was Riccardo Antonelli, who also writes a physics blog, called Hologrammata. It discusses and derives the most comfortable way to plan a relativistic journey, which may become relevant in several thousand years when we can actually go fast enough for this to matter.  In this post, I will explain what this paper is about and what inspired me to write it.

Artist's impression.

Every month, the American Journal of Physics puts out a new edition with about twenty articles. These are usually a delight to read and can be read by anyone with a basic physics background. Some of the articles are about physics education, but most of the research articles involve applications of established physics to problems nobody had quite thought of before. (This is where my tunnel-through-the-Earth paper is published).

In the October 2016 edition, I read an article called "The Least Uncomfortable Journey from A to B" (possible free version here) by three Swedish and possibly French researchers, Anderson, Desaix, and Nyqvist. In it, they ask the following question: on a linear trip taking time T from point A to point B separated by distance D, what is the trajectory (instantaneous velocity as a function of time or distance) that minimizes the  time-integrated squared acceleration? If you can't mentally convert that sentence into LaTeX, the "discomfort" here is the total acceleration that the passenger feels throughout the trip, pushing them into their seat on the first half of the trip, and thrusting them out of their seat on the second half.

The solution, which they find through Lagrangian-style variational calculus, turns out to be a trajectory with constant jerk, where the acceleration decreases linearly over the entire trip, such that the velocity is a quadratic function of time. A lot of the paper talks about various analytical approximation methods, and also computes an alternate "least uncomfortable" trajectory where the squared jerk is minimized instead of the squared acceleration.

The interesting thing about the solution is that there is only one. The relative velocity (v/vmax) as a function of the relative position (x/D) or time (t/T) does not actually depend on the distance or time. No matter how far or fast you want to go, there is only one set least-uncomfortable way to get there. However, there is a problem with this. If you want to calculate how to plan a train ride that covers 500 miles in an hour, the solution is fine. But if you want to plan a trip that goes from Earth to Jupiter in an hour, then it starts running into some problems. Although it wasn't stated in the paper, the solution only holds when D/T is  much less than the speed of light. I was curious about finding a relativistic solution to this problem, and if I get curious enough about a problem that is actually possible to solve, I can be quite persistent.

In the relativistic version of this problem, when you consider the integral over time of the squared acceleration, it matters in which reference frame the time and acceleration are being measured. Because we care about the comfort of travellers and not of stationary observers, we consider the proper acceleration and not the coordinate acceleration. This problem can be formulated either in terms of "lab" time or proper time on the ship, there are benefits to both. My first attempt at this essentially involved following Anderson et al.'s derivation except with a lot of extra Lorentz factors, which is generally not a good way to go about things, and I stalled pretty quickly.

Then one day, I was talking to my internet friend Riccardo, who had just finished his master's thesis in string theory and holography. I figured a lot of the relativistic analytical mechanics formalisms might still be fresh in his mind, so I mentioned the problem to him. He too found the problem interesting, and came to the realization that if the problem was formulated in terms of the rapidity (the hyperbolic tangent of velocity relative to c) since its derivative is proper acceleration, it could be expressed as a much neater problem than my "add a bunch of Lorentz factors" approach.

The way to derive the solution, Riccardo discovered, is to treat it as a Lagrangian function of the rapidity rather than the position (such that you write down L(r, $\dot{r}$, ) instead of L(x, $\dot{x}$) and apply the Euler-Lagrange to higher-order derivatives of position than normal). Even though we were unable to derive a closed-form solution, it turns out, the rapidity of the least uncomfortable solution evolves like a particle in a hyperbolic sine potential, and I was able to generate solutions using the Runge-Kutta algorithm, which has been serving me well since I learned how to use it in 2008.

As I said, there is only one classical solution, it is universal for all distances and times. However, when relativity it taken into account, the solution depends on how close to the speed of light it gets: there is now a single free parameter that characterizes the solution, and we can express it in terms of its maximum velocity, rapidity, or Lorentz factor. Our solution recovers the classical solution in the low-velocity limit (which is good, otherwise we'd be obviously wrong), but as the maximum speed increases, a greater fraction of the time is spent close to the maximum (which makes sense, as the path is some form of "accelerate close to light speed, decelerate down from close to light speed" and as you approach light speed, your velocity changes less and less)

A figure from the paper showing relative velocity as a function of relative time. The classical solution is the inner parabola with the car next to it, the solutions get faster as you go out, the fastest has a maximum Lorentz factor of 100 and is marked by a rocket. While making this figure I had a minor legal quandary about the copyright status of unicode emojis.

Now, we had solved the problem that I was inspired to solve, the relativistic version of Anderson et al.'s least uncomfortable journey. However, this whole thing may be moot for space travel: you don't necessarily want to keep acceleration to a minimum, instead you might want to contintually accelerate with Earth-like gravity for the first half of the trip, then reverse thrust and decelerate with Earth-like gravity for the second half, so that the entire ride (besides the switcheroo in the middle) feels like Earth. We calculated a trip like this to Alpha Centauri, which would take six years relative to Earth and 3.6 proper years on-board due to time dilation, reaching 95% light speed. With our solution, covering that distance in the same proper time would only reach 90% the speed of light, and might be more appropriate for sending mechanically sensitive electronic probes or self-replicating machines than it would be for sending people.

Anyway, we wrote up the paper and now it's online for the world's reading pleasure. It was fun seeing this paper go from a persistent idea to a finished product in a few weeks time, and dusting off some of the long-forgotten special relativity tools. It was a nice little collaboration with Riccardo, where I came up with the problem and he came up with the solution. This is the first random physics idea I've had in while that has actually come to fruition, and I hope there are many more to come.

Friday, 3 February 2017

Saturday, 14 January 2017

Empirical Searches for Nominative Determinism

Nominative determinism is the idea that a person's name influences their life or career. The Seven Dwarfs are an example, and humorous lists have been written about people with names that suit their vocation. The world's fastest man is named Bolt, there was a Russian hurdler named Stepanova, a meteorologist named Julie Freeze, and eugenics pioneer Eugen Fischer. Considerable attention is given to a urology paper by Weedon and Splatt.

To my knowledge, the idea is not taken too seriously. However, I was recently curious about the extent to which people have looked for evidence of nominative determinism. I went on Google Scholar and found some results which I'm sharing with you now.

Most analyses of nominative determinism focus on medical professions, looking at whether specialists tend to have names associated with their speciality.

Examples of nominative determinism in medical research, with statistics of N=1. Ref.
Although this study was not entirely serious, it had a number of methodological flaws as it failed to consider the prominence of each surname in the medical fields relative to its prominence in the population at large.

One recent study was by four members of a family surnamed Limb, all doctors (two of whom named C. Limb are avid climbers). They surveyed a directory of over 300,000 medical doctors grouped by speciality, and went through the list and independently noted which were suited to medicine in general and to their speciality. The lists were then merged by consensus. They found that 1 in 149 doctors had medically appropriate surnames, and 1 in 486 had names relevant to their field. They noted:

"Specialties that had the largest proportion of names specifically relevant to that specialty were those in which the English language has provided a wide range of alternative terms for the same anatomical parts (or functions thereof). Specifically, these were genitourinary medicine (eg Hardwick, Kinghorn, Woodcock, Bell) and urology (eg Burns, Cox, Dick, Koch, Cox, Balluch, Ball, Waterfall). Some terms for bodily functions have been included in the frequency counts but are not mentioned because they are colloquial terms that may lower the tone of this publication."
Another study looked at nominative determinism in patients rather than doctors, trying to see if surname influences health. Based in Ireland, the authors looked through the Dublin phone book to estimate the percentage of people surnamed Brady (0.36%), and then tried to ascertain what fraction of them had been diagnosed with bradychardia (slow heart rate). The only data they had available was for pacemaker implants, and found that 8 out of 999 pacemakers had gone to people  named Brady. Despite the small numbers, this was statistically significant (p=0.03) relative to Brady's prominence in the Dublin telephone directory. The authors don't speculate on the causes of this, but neglected to discuss the idea that doctors may be subtly biased towards diagnosing Bradys with bradycardia.

"This increased bradyphenomenon in Bradys could be attributable to increased levels of bradykinin"

In the analysis of particle physics experiments there is something called the "look elsewhere effect" where any significant effect has to be considered in light of all the other effects that are being looked for (this xkcd gives an example of the folly), which reduces the overall significance of the interesting part. I suspect that if they had looked at what other surnames were over-represented in bradycardia diagnosis, the significance of Brady would be diminished. I think this proviso should be applied to any search for nominative determinism: look at the boring names as well as the silly ones.

There are a few other studies out there, mostly tongue-in-cheek. These do go a step beyond compiling humourous lists, but not too much further.