Math - How to create any periodic wave?

Hey there,

I am having difficulty combing the waves to achieve the desired or imaginable wave. I don’t really understand the interrelationship between multiple waves, how they interact with each other. It’s being said that there’s nothing magical that you need to create interesting waves of your own, and you can pretty much create any repeating curve just by putting enough waves together.

How should you proceed? What do you need to consider? Some guidance would be appreciated

Hey @ScorpionMango, great question.
The first step would be to understand the concept of constructive and destructive interference.

In a nutshell:
When two peaks meet, the result resulting peak will be bigger.
When a peak and a trough meet, the resulting peak will be smaller.

To test this concept simply, try starting with two sine waves and move one in and out of phase.
When they match up, you’ll get a wave with a higher amplitude. When they call completely out of phase you’ll get a completely flat line.

Constructive interference:

Destructive interference:

Some arbitrary offset between the two waves:

Complex waves are really just this concept taken up a notch but this is the basic idea.

For example, here’s the same concept but with one wave having twice the freqency:


Notice that the resultant wave is still just the sum of each point from the two component waves.

I hope that helps.

1 Like

Hey @garypettie, thanks for reaching out

I do get the idea that combining multiple waves is nothing but the sum of them. Whether they interact destructively, constructively or if the overall shape of the wave becomes a complex pattern resulting from the combination of these points of constructive and destructive interference is a matter of discussing the resulting wave. So that’s the interrelationship between multiple waves

But what I’m having difficult times with is to come with a wave to achieve the desired or imaginable wave. Let’s take out few of the lecture:

y = sin⁡(x) + sin(2x)
y = 1/3sin⁡(x + π) + 1/6sin⁡(3x) + 0.5
y = ( sin⁡(3x/10) + 5sin⁡(x/10) + 7sin⁡(x/16) ) ÷ 25 + 0.5

How did you come up with these? Did you create them in a planned way or did you just manipulate sine waves randomly, add them up and see where you might be able to apply that?

If planned, how did you go about it?

It’s partly being familiar with the formulas and partly trial and error.
Start by remembering the formula: amplitude * sin(frequency * x + xOffset) + yOffset

As an example, let’s take the more complex third example and I can walk you through some of the thought process…
Here, I’m modelling some sort of damaged light. This means I really don’t care too much about the final formula and just want it to look decent enough.

I want it to flicker on and off but a pure sign wave is too predictable - I’m going to need to add a few waves together.

I know that multiply x will modify the frequency. So let’s pick there numbers that will put it reasonably out of phase to create something interesting. Here I think I arbitrarily picked 1/10, 3/10, and 1/16.

Ok we’ve made a wobbly line now but it’s still too smooth.
However, I know that multiplying on the outside will alter the frequency, so let’s pick some prime numbers, so that they don’t overlap too often. Here I picked 1, 5, 7.

Right, now we’re cooking. It looks interesting and the repetition isn’t super obvious.
But, our light only accepts values between 0-1 and this is ranging around ±11, so a lot of our details will currently be lost.

Well, if I can fix the amplitude by multiplying, so lets wrap everything we have in parentheses and divide the whole lot to make the numbers smaller. I picked 25 because it did the job and I didn’t need to be particularly precise with my output. It’s supposed to be a broken light, so there’s no set goal other than “does it look broken yet”.
You could also adjust your earlier amplitude numbers here but just dividing everything is easier.

Great, my light looks pretty broken but it’s off for extended periods of time and I only want it to be off occasionally, so that it looks like it’s still in the process of failing and not randomly sparking back to like out of nowhere.
Well, for this I just need to raise it up a bit. Again, the amount doesn’t need to be precise for this example and I don’t mind if it occasional falls below 0 or peaks at 1 for a bit, so I added 0.5.

So that’s a rough thought process for something that didn’t need to be precise.

The first and second examples were a lot more deliberate but they are also much easier to visualize because they’re much more obviously repetitive.

If you want to get a more precise outcome then you need to learn a little more math.
If you’re interested, check out more on Fourier series, which was unfortunately beyond the scope of this course.
You may also be interested in checking out the formulas for constructing construct things like; triangle waves, square waves, and sawtooth waves.
You can even do some cool stuff by constructing your functions piecewise. This is how some common easing functions like “bounce” or “elastic” work.

1 Like

Thank you for the detailed answer to my question. I appreciate the time and effort you put into explaining this concept using the example above & overall in the course.
Your answer was comprehensive and helpful, and it made me curious to learn more about combining waves, since I still think it has to do with picking arbitrary numbers, which I’m not a huge fan of.

I will definitely do further researches on it and try to apply what I learned to other problems. But as you have mentioned in the last minute in the lecture, this is not always the easiest or most efficient way of doing things, so that, at best, we use the right tools for the job

Thank you for your guidance and support.

Glad I could help.
As I mention in the course, most of math is just one topic layered on top of another.
As always, getting comfortable with the underlying concepts always makes the later stuff easier.

The lectures at the end of this section are really just the start of what there is to know on this topic, and I’m glad to hear that you’re hungry for more!
If you do look up some of the extra topics I mentioned and have no clue where to start how to read the formulas then I do cover some bits on how to interpret stuff like that in the last section of the course.

There are many profound aspects of which one is the layered structure you have mentioned that contributes to the beauty of mathematics & that’s why I’m revising these lectures, so that the knowledge I gained from the course becomes second nature first. I am never satisfied with just a little.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms