πŸ“ Wave Equation


Above you can see a simulation of the equation for the wave in 2D. (It’s interactive!) Understanding how waves work is quite important for a lot of physics, as waves can be found everywhere. If you currently listen to music, that is a (sound) wave! This screen you currently look at emits (light) waves.

For me waves were always very mysterious. How could you ever describe something with so intricate patterns with an equation? Surely it must be very complicated.

Actually, the equation for a (1D) wave is just this:

βˆ‚2u(x,t)βˆ‚t2=c2βˆ‚2u(x,t)βˆ‚x2\frac{\partial^2u(x,t)}{\partial t^2} = c^2\frac{\partial^2u(x,t)}{\partial x^2}

It is quite compact! In my case I did not have a firm understanding of all of the symbols in there so the equation was quite mysterious. Here is a quick summary of how I understood how this beautiful equation works.

Partial Differential Equations (PDEs)

The first thing to understand is, that this equation is a Partial Differential Equation (the βˆ‚\partial part gives it away). Other than β€œnormal” equations, where you try to solve for xx or some other variable, with a PDE you try to find a function. In the case of a wave function one tries to find the function u(x,t)u(x,t), which is the displacement function. The displacement function in 1D gives for every point xx at time tt how high or low it is. (For the 2D case it would just have another variable: u(x,y,t)u(x,y,t))

What the PDE now states is, that when we derive our unknown function uu twice (this is the βˆ‚2\partial^2) with respect to time (left side of the equation), it should be similar (up to a constant c2c^2) to deriving our function twice with respect to position (right side equation).

I know. It sounds like gibberish. But let’s put aside the Why?!? for a second. Any function that satisfies this condition is a wave function! One thing to notice is, that there are infinitely many such functions uu! For example a function describing a single small wave over time and another one describing many big waves over time. Usually one could describe these functions with their starting state - how they evolve in time would then be given by the wave equation.

Usually β€œfinding” such a function uu is done by simply computing the function - this is done at the top of this page. For this page I chose a simple Verlet integration algorithm1 - it really is surprisingly simple to code!

Why this equation?

This was the part that confused me the most. Why not any other equation? In fact the equation can be derived from F=maF=ma.

For this, at first let’s consider a very simple system modelling a one dimensional wave:

Imagine many vertical poles with beads on them. The poles are Ξ”x\Delta x apart. The beads can only move up and down the poles. Neighboring beads are connected with a spring.

For simplicity let’s consider that there is no gravity and no friction. Every bead then has exactly two forces acting upon them, the spring to the left and the spring to the right.

This would then give us the final force of F=F1+F2F=F_1 + F_2.

Now let’s say we have a function that can tell us the height of the beads on each pole at a given point xx. Let us call this function uu. Because our beads are exactly Ξ”x\Delta x apart, the left and right parts of the force cancel out. With that the force always shows either up or down. And how much is given simply be the difference in the heights of the beads. For now we only care about the direction of the beads. The stiffness of the joints can be added later as a constant. So if the bead in the middle is at height u(x)u(x), and the left and right one at u(xβˆ’Ξ”x)u(x - \Delta x) and u(x+Ξ”x)u(x + \Delta x), then we can write F=F1+F2F=F_1 + F_2 as:

F1+F2=u(xβˆ’Ξ”x)βˆ’u(x)Ξ”x+u(x+Ξ”x)βˆ’u(x)Ξ”xF_1 + F_2=\frac{u(x - \Delta x) - u(x)}{\Delta x} + \frac{u(x + \Delta x) - u(x)}{\Delta x}

(The Ξ”x\Delta x is there as we only care about the direction.)

Plugging it back into F=maF=ma gives:

u(xβˆ’Ξ”x)βˆ’u(x)Ξ”x+u(x+Ξ”x)βˆ’u(x)Ξ”x=ma\frac{u(x - \Delta x) - u(x)}{\Delta x} + \frac{u(x + \Delta x) - u(x)}{\Delta x} = ma

We have not yet talked about the mass mm. We just assume that the beads and springs have a given density ρ\rho per distance. Thus we can write the formula as:

u(xβˆ’Ξ”x)βˆ’u(x)Ξ”x+u(x+Ξ”x)βˆ’u(x)Ξ”x=ρΔxa\frac{u(x - \Delta x) - u(x)}{\Delta x} + \frac{u(x + \Delta x) - u(x)}{\Delta x} = \rho\Delta x a

Let’s rearrange that so that all Ξ”x\Delta x are on the left side:

1Ξ”x(u(xβˆ’Ξ”x)βˆ’u(x)Ξ”x+u(x+Ξ”x)βˆ’u(x)Ξ”x)=ρa\frac{1}{\Delta x}(\frac{u(x - \Delta x) - u(x)}{\Delta x} + \frac{u(x + \Delta x) - u(x)}{\Delta x}) = \rho a

Now in real-life there are no beads and everything is usually smooth. We can model this by making Ξ”x\Delta x very small.

lim⁑Δxβ†’01Ξ”x(u(xβˆ’Ξ”x)βˆ’u(x)Ξ”x+u(x+Ξ”x)βˆ’u(x)Ξ”x)\lim_{\Delta x \to 0}\frac{1}{\Delta x}(\frac{u(x - \Delta x) - u(x)}{\Delta x} + \frac{u(x + \Delta x) - u(x)}{\Delta x})

First we notice that what we do in the brackets as actually just computing the first derivative of uu!

lim⁑Δxβ†’01Ξ”x(βˆ’uβ€²(xβˆ’Ξ”x)+uβ€²(x))\lim_{\Delta x \to 0}\frac{1}{\Delta x}(-u'(x-\Delta x) + u'(x))

And this again is just the derivative of uβ€²u'!

uβ€²β€²(x)u''(x)

What I didn’t tell you, is that uu is actually a function of two parameters: xx and tt, for the position and the time. And what we have computed now was the derivitative with respect to the position, so xx.

βˆ‚2u(x,t)βˆ‚x2=ρa\frac{\partial^2u(x,t)}{\partial x^2} = \rho a

Now the acceleration on the right side is by definition just the second derivative of uu:

βˆ‚2u(x,t)βˆ‚x2=Οβˆ‚2u(x,t)βˆ‚t2\frac{\partial^2u(x,t)}{\partial x^2} = \rho \frac{\partial^2u(x,t)}{\partial t^2}

When we now turn it around and set c2c^2 to 1ρ\frac{1}{\rho} we have now the equation from the beginning!

βˆ‚2u(x,t)βˆ‚t2=c2βˆ‚2u(x,t)βˆ‚x2\frac{\partial^2u(x,t)}{\partial t^2} = c^2\frac{\partial^2u(x,t)}{\partial x^2}

This is it! You get the wave equation when modeling a system connected with springs!

Sources and Annotations

Footnotes

  1. 0Mean1Sigma. (2024, June 17). Wave Simulation from scratch using finite difference method [Video]. Youtube. https://youtu.be/4IL8n8yYNjw ↩