Raphaƫl Kanapitsas

The Wave Equation

Created: 4th of May

Updated: 17th of May

Still in the process of being written.

Disclaimer: math-heavy article, on a topic I learnt about by writing: it might contain errors. Please comment if you see anything not making sense!

The other day, I looked at my guitar, and realized that I didn't known how waves behave on a string, mathematically speaking. How do they propagate? The string is fixed between two points. You pluck the string, by displacing it at a certain point, and letting go. What happens then?

Derivation

Imagine a string with tension , linear mass density . We consider only the vertical displacements of the string, which should stay small (like on a string instrument). We will model our string as a function , that gives the vertical displacement given coordinate and time .

Let's forget time for now, and look at static situations. Here's a piece of string with tension acting on it on both ends.

Not much is happening here: the string is straight, the forces acting on it even out, everything stays in place. But let's look at what happens when there's some curvature.

Here, we imagine the net force would make the piece of string go downwards. We can find the mass of the piece easily: . If we can find the net force acting on it, we'll be able to apply Newton's second law.

We've made the assumption that the movement of the string is only in the direction. This means we can consider only the vertical forces acting on the piece, at and .

From this picture, we can see that the vertical fore acting at is . Knowing that the displacements are small, we can make the small angle approximation physicists love, and use the slope instead of 1, and get:

We can find the force from the other end the same way2:

We can sum them and get the net force acting on this small piece of string. Great! We have everything we need to apply Newton's second law. Let's also put back time into the equation. Reorganizing a bit: Supposing our function is well-behaved, we have: In the end, taking a general instead of , our equation becomes:

Or, as it is more often presented: This reflects well our early intuition that the more curved the string is at some point, the faster it would move. The higher the tension, the faster, the higher the mass density, the slower. Sanity check: pass.

We can do two things from here, now that we have this partial differential equation: we can stop here, and go simulate it on a computer, or we can try to find explicit solutions.

Solutions

Of course, this equation is ideal, in that it doesn't reflect all of reality. For example, there's no damping, and a movement will continue forever. But it's still useful to understand how waves propagate in this environment, especially if we can find the general form of the solutions.

Separation of variables

Let's try to simplify the problem by "trying out" the assumption that can be written as the product of two simpler functions, each depending on only one parameter:

This severely simplifies the problem and limits the number of forms that can take. Let's substitute for this product in the wave equation:

When and , we can rearrange a bit3 Each side depends only on one variable, which means they are both equal to the same constant!

Solving each side

Let's take the left-hand side first

If we're looking for a function whose derivative is almost the same, we're looking at the exponential. Let's set . We get that: If , we have , but we're probably not looking for an exponential function, as it won't satisfy our boundary conditions. On the other hand, if , we have , which looks a lot more like the waves we've been talking about.

It makes sens intuitively: if , the function has a positive curvature when it's already positive, making it grow even more. In the other case, it has a negative curvature, which is more reminiscent of the restoring force we found in the first part.

For simplicity, let's set , so that we have: We can follow the exact same procedure for , which is the same equation with a additional multiplicative constant. and try So that . Let's define for simplicity.

Our two resulting "elemental" solutions (actually four, counting the signs) are: But the equation is linear, meaning that any linear composition of these is still a solution. That means our general form is:

Where

Applying the boundary conditions

Spatial

We are ready to apply some boundary conditions. First, the string is fixed in place at and , which means that we have . The first one translates to: So at least one of the member is null. For the right side to be null would mean that which leads to a non-moving string. Other wise, we have , and Applying the condition from the other end of the string, we get: Which is valid for any , meaning can be a superposition of those:

Temporal

If we consider the movement of a guitar string, at the initial pluck, the velocity of the string is everywhere (before the player lets the string go). Which means that : We can now simplify the writing of : We also know that , which means we also have a superposition here:

Final solution

By combining these terms, with new , we have4

And by applying we get Which is a more interpretable form of the solutions: for each frequency, there's a wave going to the right, and another going to the left. In this form, we can also see that is the speed at which the wave propagates. Let's re-write it with that simplification in mind:

Actually, we still have an unknown, or rather an infinity of them, namely all the s. But these can be determined with the initial state of the string . If we plug that in, we obtain: Which is just the Fourrier decomposition of the initial state.

(TODO add explanation about Fourrier series)

Read more here

Simulation

Now a bit of fun. By making the domain (both temporally and spatially) discrete, we can model the string at time by an array , where and is the spatial definition. We can keep track of the vertical speed of the string at any point with another array .

This way, we can keep track of the system at time , and update it based on the previous equation. This is done using a finite-difference approximation of the second spatial derivative (which is just the approximation you get by considering the definition of a derivative)

From this, using the wave equation, we get an approximation of acceleration. Integrating once is easily approximated: This gives us the change of speed, with which we can update our and by "integrating" again...

...we get an update to our by doing and the cycle starts again, approximating the new position and speed at each time step. Of course, all that is of no use if we don't get to see it in action!

100
4
200
1
Hz
FPS: 0
0x
VIEW

Comparison with a real string



  1. Indeed because when is close to

  2. The sign difference comes from the two different directions for tension. 

  3. Otherwise, both sides of the equation are equal to zero anyway. 

  4. There's only one sum because and are linearly dependent.