The Wave Equation
A guitar string, a drum skin, sound in a pipe and electromagnetic waves all obey the wave equation
where is the wave speed. For a string of length fixed at both ends, is the displacement. Unlike the heat equation, it needs two initial conditions (position and velocity), and its solutions do not decay: they oscillate forever.
The problem
Separation of variables
With : . The space part is the same eigenvalue problem as for heat, , . The time part is now a second-order equation, , an oscillator with angular frequency :
At : and , so are the sine coefficients of , and those of divided by .
Music: harmonics
The mode frequencies are integer multiples of the fundamental . That is why a string has a clear pitch, with overtones at 2, 3, 4, … times the fundamental. Halving (pressing a fret at the middle) doubles the frequency: one octave up. With tension and linear density , .
import numpy as np
L, T, mu = 0.65, 70.0, 0.0004 # guitar-like string: 65 cm, 70 N tension, 0.4 g/m
c = np.sqrt(T / mu)
f1 = c / (2 * L)
print(f"wave speed {c:.1f} m/s, fundamental {f1:.1f} Hz")
print("first five harmonics:", np.round(f1 * np.arange(1, 6), 1))wave speed 418.3 m/s, fundamental 321.8 Hz
first five harmonics: [ 321.8 643.6 965.4 1287.2 1609. ]
Example: a plucked string
Pull the middle of a string of length 1 to height and release from rest: is a triangle, . The sine coefficients of the triangle are : only odd harmonics, decaying like . Plucking at a different point changes the mix of harmonics, which is why the same guitar string sounds brighter when picked near the bridge.
import numpy as np
h, c, L = 0.01, 1.0, 1.0
n = np.arange(1, 400)
A = 8 * h / (n * np.pi)**2 * np.sin(n * np.pi / 2)
u = lambda x, t: np.sum(A * np.cos(n * np.pi * c * t / L) * np.sin(n * np.pi * x / L))
for t in (0.0, 0.25, 0.5, 1.0, 2.0):
print(f"t = {t}: u(0.5) = {u(0.5, t): .5f}, u(0.25) = {u(0.25, t): .5f}")t = 0.0: u(0.5) = 0.00999, u(0.25) = 0.00500
t = 0.25: u(0.5) = 0.00500, u(0.25) = 0.00499
t = 0.5: u(0.5) = 0.00000, u(0.25) = 0.00000
t = 1.0: u(0.5) = -0.00999, u(0.25) = -0.00500
t = 2.0: u(0.5) = 0.00999, u(0.25) = 0.00500
At the string is upside down, and at it is back where it started: the motion is periodic with period .
Energy is conserved
The energy (kinetic plus stretching) is constant in time: differentiate under the integral and integrate by parts using the equation and the fixed ends. The wave equation, unlike the heat equation, loses nothing; real strings stop because of air resistance and internal friction, which add a damping term .
In software
- Physical-modelling synthesis (the Karplus-Strong algorithm and digital waveguides) simulates the wave equation on a string to make realistic plucked sounds.
- Seismic imaging, ultrasound and radar solve the wave equation numerically on huge grids; The Wave Equation and the CFL Condition covers the time-step limit those codes obey.
Exercises
Exercise 1: One mode
Solve on , fixed ends, , .
Answer
.
Solution
, , : .
Exercise 2: Initial velocity
Same equation, , .
Answer
.
Solution
and , so .
Exercise 3: Octaves and fifths (code)
A string's fundamental is 110 Hz. Which length fraction gives 165 Hz, and which harmonic of the open string equals the second harmonic of the shortened string?
Answer
of the length; the 3rd harmonic (330 Hz).
Solution
, so . The shortened string's second harmonic is : the musical fifth shares overtones with the root.
from fractions import Fraction
f1 = 110
print(Fraction(f1, 165), [f1 * k for k in range(1, 5)], [165 * k for k in range(1, 3)])2/3 [110, 220, 330, 440] [165, 330]
Test yourself
How many initial conditions does the wave equation need?
- One:
- Two: and
- None
- Three
The mode frequencies of a fixed string are…
- , integer multiples of the fundamental
- random
Compared with the heat equation, solutions of the wave equation…
- decay faster
- oscillate without decaying
- are always zero
- blow up