# In Search of The Fourth Wave

Last year I participated in the first DSP Related online conference, where I presented a short talk called "In Search of The Fourth Wave". It's based on a small mystery I encountered when I was working on Think DSP.  As you might know:

1.  A sawtooth wave contains harmonics at integer multiples of the fundamental frequency, and their amplitudes drop off in proportion to 1/f.
2. A square wave contains only odd multiples of the fundamental, but they also drop off like 1/f.
3. A triangle wave also contains only odd multiples, but they drop off like 1/f².

This pattern suggests that there is a fourth simple waveform that contains all integer multiples (like a sawtooth) and drops off like 1/f² (like a triangle wave).  Do you know what it is?

In the talk, I suggest four ways to solve this mystery, and in the Q&A, one of the attendees suggests a fifth.

You can watch the talk here:

[ - ]
Comment by October 1, 2021

Which was the suggested 5th method?

[ - ]
Comment by October 1, 2021

Convolving a square wave with itself.

[ - ]
Comment by November 11, 2023

Great video!

What exactly do the command "wrap" do?

As in;

def parabola_func(cycles):

ys = wrap(cycles) - 0.5

return ys**2

I am trying to find the C/C++ equivalent, thanks

[ - ]
Comment by November 11, 2023

It's defined in the notebook (https://colab.research.google.com/github/AllenDown...)

def wrap(cycles):

frac, _ = np.modf(cycles)

return frac

`wrap` uses `modf` to compute the fraction part of the number of cycles.

Should be easy enough to translate!

To post reply to a comment, click on the 'reply' button attached to each comment. To post a new comment (not a reply to a comment) check out the 'Write a Comment' tab at the top of the comments.