Last month, in Falmouth High School in Maine, some Honors Physics students were estimating the period of a mass hanging from a spring. They used InquirySpace/Data Games software and Vernier motion sensors, and got data that looks like this (**Reading** is in meters; **Time** in seconds):

To do their investigations, they needed the period of this wave.

- Some students found the peak of one wave, and subtracted its time from the peak of the next wave. This is the most straightforward and obvious. But if you do that, your period will always be a multiple of the time between points, in this case, 0.05 seconds. (This is part of what must have happened in the previous post.)
- Some students—sometimes with prodding—would take the time difference across several waves, and divide by the number of periods. It’s not obvious to students that this technique gives a more precise measurement for the period. It’s interesting to think about how we know that this is so; for example, if you use five periods, it’s now
*possible*to get any multiple of 0.01 seconds; but does that mean it’s actually more precise? (Yes.) This technique also gives students a chance to be off by one: do you count the peaks? No. You have to count the spaces*between*the peaks. (Getting students to explain why is illuminating.) - We could imagine trying to fit a sinusoid (and some students would, but it’s hard) or using a Fourier Transform (which is a black box for most students).

But this post is about an alternative to all of these techniques—one that uses all the data and gives a much more precise result than the first two.

You can read about this is excruciating detail in a paper I wrote. And I made one particularly careful group of students this (awkward and quickly-made) video describing the technique. So I will be brief here.

The key idea is that a periodic function, by its very nature, repeats itself. Follow this subjunctive/conditional logic:

*If we knew the period*, we could split up the wave into period-length slices. If we superimposed these slices, they’d all lie on top of one another.

Alas, we don’t know the period. But if we have a *proposed* period, we can still slice up the wave and do the superposition. *Then we vary the proposed period until the slices line up*. When they do, our period will be correct. (Almost. We could be off by an integer factor, but we’ll avoid that.)

How do you do this?

- Make a slider for your proposed period; call it
**P**. (If you don’t have sliders in your software, make some named parameter you can vary.) - Make a new column in your data table, call it
**Phase**. - Give phase the formula:
**Time % P**. (In some systems this might be something like**Time mod P**or**MOD(time, P)**.) - In the graph, replace
**Time**with**Phase**. Now you have a**Reading-Phase**graph. The superimposed waves appear. - Vary
**P**until the waves line up. - A good range for
**P**is the range over which the waves seem to line up pretty well.

The percent sign—the *modulo* function—does the magic. It produces the *remainder* when you divide **Time** by **P**. That is, if you divide the whole time up into slices **P** seconds long, we can think of the beginning of each slice as a new zero. Then this remainder is how far each point is into its particular slice. If this isn’t quite making sense, don’t be alarmed. Persist. It’s quite elegant.

In our data, the period looks as if it’s about 0.6. Here is our **Reading**–**Phase** graph, with P = 0.6:

The orderliness is deceiving. The points are all aligned vertically because 0.6 seconds is exactly 12 data intervals. If we adjust the slider, the points slither around, but we quickly find that they line up better with a slightly shorter period. Here is what it looks like when P = 0.595:

Note: The curve gets ragged at peak and trough (unlike the cleaner data in the video) because the amplitude of this wave decreased markedly in the 10 periods we observed (You can see it in the first graph, up at the beginning of the post). But we can still use the technique; the key is to focus on the places where the curve rises and falls through the axis instead of at the peak or trough. Make those smooth, and you have a good period.

I love this not just because it works, but that it shakes things up a bit:

- In the traditional syllabus, this approach is alien. But when you take a little time with it, it’s not all that mysterious. And it works really well.
- We often think of
*periodic*as synonymous with*sinusoidal*. This gets back to basics. - I think
*modulo*is neglected because it’s not on the road to calculus. But it’s been useful in computer science since the beginning, and here’s an example where it’s useful in data analysis. - Remember back in grade 3 or 4? Remainders? It’s cool to have them come back in something more tangible than the Remainder Theorem in algebra.

## 4 thoughts on “Wave Slicing and Remainders: a cool way to find the period of a periodic function”