Flow Lab

Syllabus / Module 9: Classical PDEs: Heat, Waves & Potentials

Lesson 9.4

The Wave Equation & Vibrating Strings

Derivation for a string, separation of variables, normal modes, harmonics and energy.

Written byClaude Sonnet

🌊
Why this matters for simulation: Sound is a wave equation for pressure — the compressible part of fluid flow.

By the end of this lesson you can…

  • Derive $u_{tt} = c^2u_{xx}$ from Newton's second law for a small piece of string, and compute $c = \sqrt{T/\rho}$ and the pitch of a given string.
  • Factor the wave operator to get $u = F(x - ct) + G(x + ct)$, and use it to predict how a pulse splits and reflects at fixed and free ends.
  • Separate variables to get the normal modes $\sin(k\pi x/L)\cos(k\pi ct/L)$, and explain why the frequencies form the harmonic series $k\,c/2L$.
  • Expand a plucked or struck string in modes, and say why the plucked coefficients fall like $1/k^2$ and show no Gibbs overshoot in the displacement.
  • Show that the energy is conserved, and contrast the wave equation with the heat equation (no decay, reversible, finite speed).
  • Explain why a leapfrog scheme for the wave equation needs $c\,\Delta t/\Delta x \le 1$, using the measured error and blow-up.
On this page
·
  1. From Newton’s law to utt=c2uxxu_{tt} = c^2 u_{xx}utt​=c2uxx​
  2. Two traveling waves: characteristics again
  3. Standing waves: separation of variables
  4. The plucked string
  5. Energy: the wave equation does not forget
  6. Wave versus heat
  7. The numerical link: leapfrog and c Δt/Δx≤1c\,\Delta t/\Delta x \le 1cΔt/Δx≤1
  8. Check your understanding
  9. Problems
  10. Computation
  11. Key Takeaways
  12. What comes next

8.6 Orthogonal Polynomials & Special Functions ended with a promise: a string’s modes are sines with frequencies kπc/Lk\pi c/L, the integer multiples that make a guitar sound like a note, while a drum’s modes use Bessel zeros and come out at 1,2.2954,3.5985,4.90331, 2.2954, 3.5985, 4.9033 times the lowest. This lesson cashes in the first half of that promise. The wave equation is also the first equation of this module that does not smooth things out. A heat profile forgets its shape; a wave remembers it forever. For a simulator that difference is everything: sound, pressure waves in a duct and the information carried by a supersonic flow all run on this equation, and its numerical scheme has a stability limit of a different kind from the heat equation’s.

▶ Video A string from Newton's law, the pulse that splits into two traveling halves, the normal modes, the plucked string and the conserved energycaptions only
Transcript
  1. Take a small piece of a stretched string, with tension T and density rho. The tension pulls on both ends, and where the string curves the two pulls do not cancel. For small slopes the net force is T u x x times the length, and mass times acceleration gives u t t equals c squared u x x, with c the square root of T over rho. For a string at 70 newtons, 0.4 grams per metre and 0.65 metres long, c is 418.3 metres per second and the lowest note is 321.8 hertz.
  2. The operator factors into two transport operators, so every solution is a right-moving shape plus a left-moving one. Release a bump at rest, and it splits into two copies at half the height, running apart at speed c. At time 0.3 the string is exactly zero outside 0.1 to 0.9: information has a finite speed, which heat does not have.
  3. The ends are mirrors. A fixed end is an odd extension: the pulse comes back upside down. A free end is an even extension: it comes back upright. At time 0.7, at x equal 0.2, the displacement is minus 0.5 with fixed ends and plus 0.5 with free ends.
  4. Now separate variables. The space problem gives sine of k pi x over L, and the time equation gives cosine of omega k t, an oscillation instead of heat's decay. The frequencies are k times c over 2 L, the harmonic series, so the motion repeats and the ear hears a pitch. A standing wave is just two equal traveling waves, and a pulse is a sum of standing waves.
  5. Pluck the string at a quarter of its length, to height 1. The coefficients fall like 1 over k squared: 0.76421, 0.27019, 0.08491, then exactly zero, because sine of 4 pi over 4 is zero. Every fourth harmonic is missing. The energy shares are 0.542, 0.271, 0.060, 0, 0.022 and 0.030, so over half the energy sits in the fundamental.
  6. Because the triangle is continuous, with only a corner in its slope, the sums converge with no Gibbs overshoot. The biggest gap between the K term sum and the triangle is 0.13 at K equal 3, 0.049 at 10, 0.011 at 50 and 0.0027 at 200. It falls roughly like 1 over K, and it all sits at the corner.
  7. Energy is kinetic plus potential, and it is exactly conserved. For the quarter pluck all 2.667 starts as potential. At time 0.25 the kinetic energy is 1.778 and the potential energy is 0.889, and the total is still 2.667. Summing 200 modes gives 2.659, and the missing 0.3 percent is the tail. Unlike heat, nothing decays, and the motion is reversible.
  8. To simulate it, use leapfrog on 100 cells, with Courant number nu equal c delta t over delta x. At nu equal 1 each step shifts the data by exactly one cell, and the error is round-off, about 10 to the minus 15. At 0.8 the corner disperses, and the error is 0.022. At 1.05, just 5 percent over the limit, the solution grows to about 10 to the 48 in 190 steps. That is the CFL condition: information may not cross more than one cell per step.
  9. Strike the string instead of plucking it. A hammer on 0.45 to 0.55 gives velocity, not displacement. The sine coefficients now come from the velocity: g 1 is 0.199, g 3 is minus 0.193, and the even ones vanish because the hammer sits at the midpoint. The exact energy is 0.050 and the 200 mode sum gives 0.0495.
  10. To recap. Newton's law gives u t t equals c squared u x x. Solutions are two traveling waves, mirrored at the ends, or a sum of standing modes at harmonic frequencies. The plucked string has no Gibbs overshoot, its energy is conserved, and leapfrog needs nu at most 1. Next, d'Alembert's solution and characteristics: the formula on an infinite line, and what each point can influence.

From Newton’s law to utt=c2uxxu_{tt} = c^2 u_{xx}

Stretch a string of linear density ρ\rho (mass per length) to tension TT and let u(x,t)u(x,t) be its small sideways displacement. Take a piece between xx and x+Δxx + \Delta x. The tension pulls along the string at both ends. At the right end the string makes an angle θ(x+Δx)\theta(x + \Delta x) with the horizontal, so the vertical pull is Tsin⁡θT\sin\theta, and for small slopes sin⁡θ≈tan⁡θ=ux\sin\theta \approx \tan\theta = u_x. The net vertical force is

T ux(x+Δx)−T ux(x)≈T uxx Δx.T\,u_x(x + \Delta x) - T\,u_x(x) \approx T\,u_{xx}\,\Delta x .

The mass is ρ Δx\rho\,\Delta x, so Newton’s law mass×acceleration=force\text{mass} \times \text{acceleration} = \text{force} reads ρ Δx utt=T uxx Δx\rho\,\Delta x\,u_{tt} = T\,u_{xx}\,\Delta x. Cancel Δx\Delta x:

utt=c2 uxx,c=T/ρ.u_{tt} = c^2\,u_{xx},\qquad c = \sqrt{T/\rho}.

The law is second order in time because forces change acceleration, not displacement. Two things are assumed: slopes are small (the horizontal tension stays TT and sin⁡θ≈tan⁡θ\sin\theta \approx \tan\theta), and the string is perfectly flexible. For large slopes the equation turns nonlinear (from memory, not derived here).

A heavier string is slower, a tighter one faster, and quadrupling the tension doubles cc.

An example (illustrative numbers, not a measured string). Take T=70T = 70 N, ρ=0.4\rho = 0.4 g/m =4×10−4= 4\times10^{-4} kg/m and length L=0.65L = 0.65 m. Then c=70/(4×10−4)=175000=418.3c = \sqrt{70/(4\times10^{-4})} = \sqrt{175000} = 418.3 m/s, and the lowest note is the one that fits one half-wave in the string, f1=c/(2L)=418.3/1.3=321.8f_1 = c/(2L) = 418.3/1.3 = 321.8 Hz. The sim’s sliders compute the same numbers.

Being second order in time, the equation needs two initial conditions, the shape u(x,0)=f(x)u(x,0) = f(x) and the velocity ut(x,0)=g(x)u_t(x,0) = g(x), plus an end condition: fixed (u=0u = 0) or free (ux=0u_x = 0).

Two traveling waves: characteristics again

The operator factors, exactly as a2−b2=(a−b)(a+b)a^2 - b^2 = (a-b)(a+b) does:

utt−c2uxx=(∂t−c ∂x)(∂t+c ∂x)u.u_{tt} - c^2u_{xx} = \bigl(\partial_t - c\,\partial_x\bigr)\bigl(\partial_t + c\,\partial_x\bigr)u .

Each factor is the transport operator of 9.10 First-Order PDEs: Advection & Characteristics, and the one from 9.11 Nonlinear Waves: Burgers' Equation & Shocks with cc held constant. Introduce the characteristic coordinates ξ=x−ct\xi = x - ct and η=x+ct\eta = x + ct. By the chain rule utt−c2uxx=−4c2uξηu_{tt} - c^2u_{xx} = -4c^2u_{\xi\eta}, so the equation says uξη=0u_{\xi\eta} = 0. Integrate in ξ\xi and then in η\eta:

u(x,t)=F(x−ct)+G(x+ct).u(x,t) = F(x - ct) + G(x + ct).

Any right-moving shape FF and left-moving GG solve the equation, and so does their sum (linearity). With zero initial velocity, F=G=f/2F = G = f/2: the initial shape splits into two half-size copies that run apart. With g≠0g \ne 0 one adds the term 12c∫x−ctx+ctg ds\tfrac{1}{2c}\int_{x-ct}^{x+ct}g\,ds, which is d’Alembert’s formula; the next lesson is devoted to it, so here I use it as a tool.

Information has a speed. If f=g=0f = g = 0 outside an interval, then u(x,t)=0u(x,t) = 0 for every xx farther than ctct from that interval. Heat has no such limit: warmth anywhere is felt everywhere, however faintly, at once.

Ends are mirrors. A fixed end forces u(0,t)=0u(0,t) = 0, which we get by extending the initial shape to the whole line as an odd function: the part of the wave that has crossed the end is replaced by an upside-down copy. A free end forces ux=0u_x = 0, which an even extension supplies. The pulse comes back inverted at a fixed end and upright at a free end. In the sim below: a cosine-squared bump of width 0.20.2 centred at x=0.5x = 0.5, released at rest, at t=0.3t = 0.3 is two separate bumps of height exactly 0.50.5 and the string is exactly zero outside [0.1,0.9][0.1, 0.9] (finite speed). At t=0.7t = 0.7 the left half has hit the end at x=0x = 0 and is coming back; at x=0.2x = 0.2 the displacement is −0.5-0.5 for fixed ends and +0.5+0.5 for free ends.

◆ Interactive The string: traveling halves, mode sums, energy and the leapfrog scheme

Loading simulation…

What to try. Play the pulse with the halves visible and flip the ends between fixed and free; switch to the pluck and drag KK; tick the leapfrog box.

Standing waves: separation of variables

Look for solutions that are a product u=X(x) T(t)u = X(x)\,T(t), as in 9.3 Solving the Heat Equation: Separation of Variables. Substituting, T′′/(c2T)=X′′/XT''/(c^2T) = X''/X is a function of tt on one side and of xx on the other, so both equal a constant −λ-\lambda:

X′′=−λX,T′′=−c2λ T.X'' = -\lambda X,\qquad T'' = -c^2\lambda\,T .

The space problem is the Sturm-Liouville problem of 8.2 Eigenvalue Problems & Sturm–Liouville Theory. With fixed ends on [0,L][0,L] it has λk=(kπ/L)2\lambda_k = (k\pi/L)^2 and Xk=sin⁡(kπx/L)X_k = \sin(k\pi x/L); with free ends, cosines. For heat, the time equation T′=−λαTT' = -\lambda\alpha T gave a decaying exponential; here T′′=−c2λkTT'' = -c^2\lambda_kT gives oscillation at angular frequency ωk=cλk=kπc/L\omega_k = c\sqrt{\lambda_k} = k\pi c/L. The normal modes are

uk(x,t)=sin⁡kπxL [akcos⁡ωkt+gkωksin⁡ωkt],u_k(x,t) = \sin\frac{k\pi x}{L}\,\Bigl[a_k\cos\omega_kt + \frac{g_k}{\omega_k}\sin\omega_kt\Bigr],

and the general solution is their sum, u=∑k≥1uku = \sum_{k\ge1}u_k. The constants are fixed by the initial data: ak=2L∫0Lfsin⁡(kπx/L) dxa_k = \tfrac2L\int_0^Lf\sin(k\pi x/L)\,dx is the sine coefficient of ff, and gkg_k the same for gg, exactly the formulas of 8.3 Fourier Series.

The harmonic series. The frequencies in hertz are fk=ωk/2π=k c/(2L)f_k = \omega_k/2\pi = k\,c/(2L): the lowest one (the fundamental) and its integer multiples, the harmonics. Every frequency is a whole multiple of the lowest, so the motion repeats with period 2L/c2L/c and the ear hears a definite pitch. Mode kk has k−1k - 1 interior nodes; touch a guitar string lightly at its midpoint and you kill the odd modes, leaving the octave. The drum of the previous lesson has frequency ratios 1,2.2954,3.5985,4.90331, 2.2954, 3.5985, 4.9033 (quoted from that lesson, not recomputed here), which are not whole numbers, so a drumhead does not ring with a clear pitch. The Bessel-function modes get their own lesson, 9.8 Higher Dimensions: Membranes & Drums.

Two pictures, one solution. A sine times a cosine is a pair of waves:

sin⁡kπxLcos⁡kπctL=12sin⁡kπ(x−ct)L+12sin⁡kπ(x+ct)L.\sin\frac{k\pi x}{L}\cos\frac{k\pi ct}{L} = \tfrac12\sin\frac{k\pi(x - ct)}{L} + \tfrac12\sin\frac{k\pi(x + ct)}{L}.

A standing wave is two equal traveling waves, and a pulse is a sum of standing waves. The sim confirms that d’Alembert’s formula and the 200-mode sum of the quarter pluck differ by at most 0.00270.0027 (at t=0t = 0 and 11; 0.00140.0014 at t=0.37t = 0.37): the truncated tail.

The plucked string

Pull the string to a triangle with its peak, height h=1h = 1, at x0x_0, and let go. The initial velocity is 00, so gk=0g_k = 0. The sine coefficients of the triangle are

ak=2h sin⁡(kπx0)k2π2 x0(1−x0).a_k = \frac{2h\,\sin(k\pi x_0)}{k^2\pi^2\,x_0(1 - x_0)} .

(Integrate by parts twice, as in 8.3 Fourier Series: the only contribution comes from the corner at x0x_0.) For x0=1/4x_0 = 1/4 the sim’s midpoint rule gives

a1,…,a6=0.76421, 0.27019, 0.08491, 0, −0.03057, −0.03002.a_1, \dots, a_6 = 0.76421,\ 0.27019,\ 0.08491,\ 0,\ -0.03057,\ -0.03002 .

The fourth is zero because sin⁡(4π/4)=0\sin(4\pi/4) = 0: pluck at a quarter of the length and every fourth harmonic is missing, and pluck at the midpoint and every even harmonic is missing.

No Gibbs. The coefficients fall like 1/k21/k^2, not the 1/k1/k of the square wave in 8.5 Convergence & the Gibbs Phenomenon. The reason is that the triangle is continuous with a corner; only its slope jumps. The partial sums converge uniformly, and the overshoot of order 9%9\% of the jump never appears. The biggest gap between the KK-term sum and the triangle at 401401 sample points (the corner is one):

KK31050200
max error0.130.0490.0110.0027

The error falls roughly like 1/K1/K, concentrated at the corner.

A half period later. The string is exactly turned over and reversed. By d’Alembert, u(x,L/c)=F(x−L)/2+F(x+L)/2=F(x+L)=−f(L−x)u(x, L/c) = F(x - L)/2 + F(x + L)/2 = F(x + L) = -f(L - x): at x=0.25x = 0.25 the value is −f(0.75)=−0.250.75=−0.3333-f(0.75) = -\tfrac{0.25}{0.75} = -0.3333 for L=c=1L = c = 1. The 200-mode sum gives −0.33333-0.33333.

A struck string. A hammer gives the string a velocity gg on a small interval instead of a displacement. Then ak=0a_k = 0 and gkg_k supplies the sine coefficients, and the displacement amplitude of mode kk is gk/ωkg_k/\omega_k. With g=1g = 1 on [0.45,0.55][0.45, 0.55] the sim gets g1=0.199g_1 = 0.199 and g3=−0.193g_3 = -0.193; the even ones vanish because the hammer sits at the midpoint.

Energy: the wave equation does not forget

Define the energy of the string as kinetic plus potential:

E=∫0L(12ρ ut2+12T ux2)dx.E = \int_0^L\Bigl(\tfrac12\rho\,u_t^2 + \tfrac12T\,u_x^2\Bigr)dx .

Differentiate in time, use ρutt=Tuxx\rho u_{tt} = Tu_{xx}, and integrate the second term by parts:

dEdt=∫0Lut(ρutt−Tuxx)dx+[T uxut]0L=0.\frac{dE}{dt} = \int_0^L u_t\bigl(\rho u_{tt} - T u_{xx}\bigr)dx + \Bigl[T\,u_xu_t\Bigr]_0^L = 0 .

The bracket vanishes at fixed ends (ut=0u_t = 0) and at free ends (ux=0u_x = 0). Energy is exactly conserved. Kinetic and potential energy trade places, but the total is constant.

Worked example. Take ρ=T=1\rho = T = 1 and the quarter pluck. At t=0t = 0 all energy is potential: ux=4u_x = 4 on (0,14)(0, \tfrac14) and −43-\tfrac43 on (14,1)(\tfrac14, 1), so E=12[16⋅14+169⋅34]=83=2.667E = \tfrac12\bigl[16\cdot\tfrac14 + \tfrac{16}{9}\cdot\tfrac34\bigr] = \tfrac{8}{3} = 2.667. At t=14t = \tfrac14, use ux=12[F′(x−t)+F′(x+t)]u_x = \tfrac12[F'(x-t) + F'(x+t)] and ut=12[F′(x+t)−F′(x−t)]u_t = \tfrac12[F'(x+t) - F'(x-t)] with F′=4F' = 4 on (−14,14)(-\tfrac14,\tfrac14) and −43-\tfrac43 elsewhere. For x<12x < \tfrac12: ux=43u_x = \tfrac43, ut=−83u_t = -\tfrac83. For x>12x > \tfrac12 both F′F' equal −43-\tfrac43, so ux=−43u_x = -\tfrac43, ut=0u_t = 0. Then

KE=12⋅649⋅12=169=1.778,PE=12(169⋅12+169⋅12)=89=0.889,\text{KE} = \tfrac12\cdot\tfrac{64}{9}\cdot\tfrac12 = \tfrac{16}{9} = 1.778,\qquad \text{PE} = \tfrac12\Bigl(\tfrac{16}{9}\cdot\tfrac12 + \tfrac{16}{9}\cdot\tfrac12\Bigr) = \tfrac89 = 0.889,

and the total is 249=2.667\tfrac{24}{9} = 2.667 again. The sim’s quadrature agrees at t=0.25t = 0.25, 0.50.5 and 1.371.37 (kinetic 1.7781.778, potential 0.8890.889), and at t=0t = 0 and 11 it shows kinetic 00, potential 2.6672.667.

In modes. Each mode carries its own energy Ek=L4(ωk2ak2+gk2)E_k = \tfrac L4(\omega_k^2a_k^2 + g_k^2) (density 11), and the total is ∑Ek\sum E_k (a Parseval statement). For the quarter pluck, the shares of modes 11 through 66 are 0.542,0.271,0.060,0,0.022,0.0300.542, 0.271, 0.060, 0, 0.022, 0.030, so over half the energy is in the fundamental. Summing 200 modes gives 2.6592.659 against 2.6672.667: the tail holds about 0.3%0.3\%. For the hammer the exact energy is 12∫g2=0.050\tfrac12\int g^2 = 0.050 and the 200-mode sum gives 0.04950.0495.

Wave versus heat

heat equationwave equation
time derivativefirstsecond
mode kk in timedecays, e−αλkte^{-\alpha\lambda_kt}oscillates, cos⁡ωkt\cos\omega_kt, forever
energydissipatedconserved (with no damping)
reversible in time?no: backward runs blow upyes: t→−tt \to -t leaves the equation unchanged
signal speedinfinite (tiny but nonzero)exactly cc
cornerssmoothed out at oncestay as corners, carried along

Replace uttu_{tt} and uxxu_{xx} by central differences on a grid with spacing Δx\Delta x and time step Δt\Delta t:

ujn+1=2ujn−ujn−1+ν2(uj+1n−2ujn+uj−1n),ν=c ΔtΔx.u_j^{n+1} = 2u_j^n - u_j^{n-1} + \nu^2\bigl(u_{j+1}^n - 2u_j^n + u_{j-1}^n\bigr),\qquad \nu = \frac{c\,\Delta t}{\Delta x}.

This is the leapfrog scheme, with the Courant number ν\nu (the first step is u1=u0+Δt g+ν22δ2u0u^1 = u^0 + \Delta t\,g + \tfrac{\nu^2}{2}\delta^2u^0). The value ujn+1u_j^{n+1} depends on only three grid points of the previous step, so the scheme’s numerical domain of dependence has speed Δx/Δt=c/ν\Delta x/\Delta t = c/\nu. If ν>1\nu \gt 1, the true solution at a point depends on data from outside that interval, and no scheme that ignores it can converge: this is the CFL condition (name and argument from memory; 10.5 Wave Equation Numerics & the CFL Condition does it properly). Compare 10.2 Explicit Methods for the Heat Equation: heat needs Δt≤Δx2/2α\Delta t \le \Delta x^2/2\alpha, the wave only Δt∝Δx\Delta t \propto \Delta x.

The sim runs it on 100 cells for the quarter pluck, against the exact d’Alembert solution, up to t≈1t \approx 1 (the half period):

ν\nustepsmax errormax ∣u∣\lvert u\rvert
1.0100≈10−15\approx 10^{-15} (round-off)1.00
0.81250.0220.986
0.52000.0290.981
1.05190 (at t≈2t \approx 2)∼1048\sim10^{48}∼1048\sim10^{48}

At ν=1\nu = 1 leapfrog is exact on this grid, because the numerical and true characteristics coincide: each step shifts the data by one cell. Reduce ν\nu and the error is larger, not smaller, as the scheme starts to disperse the corner (short waves travel slower than cc); the 10−1510^{-15} is round-off, and at 1.051.05 the short-wave content of the corner grows at every step without bound. That short waves lag behind cc is a standard fact quoted from memory; the error column is the measurement. Just 5%5\% over the limit gives 104810^{48} in 190 steps.

Check your understanding

✅ Concept check

A string is stretched so its tension is multiplied by 4 (the length and density stay the same). By what factor does the wave speed, and hence the pitch, change?

✅ Concept check

A pulse traveling to the right on a string reaches an end. What comes back?

✅ Concept check

Why do the sine coefficients of a plucked string fall like $1/k^2$, with no Gibbs overshoot, while a square wave's fall like $1/k$?

✅ Concept check

You run leapfrog with $\nu = c\Delta t/\Delta x = 1.05$. What does the lesson's measurement predict?

Problems

✏️ Pen & paperA string's pitch●○○

A string of length 0.650.65 m, linear density 0.40.4 g/m, has tension 7070 N. Find the wave speed and the frequencies of the first three harmonics. By what factor must the tension change to raise the fundamental by a factor of 22?

Show worked solution

c=T/ρ=70/(4×10−4)=418.3c = \sqrt{T/\rho} = \sqrt{70/(4\times10^{-4})} = 418.3 m/s. The fundamental is f1=c/2L=418.3/1.3=321.8f_1 = c/2L = 418.3/1.3 = 321.8 Hz, and the harmonics are f2=643.6f_2 = 643.6 Hz and f3=965.4f_3 = 965.4 Hz. Since f1∝Tf_1 \propto \sqrt T, doubling the pitch needs TT to be multiplied by 44, that is 280280 N.

✏️ Pen & paperPlucked at the midpoint●●○

A string on [0,1][0,1] with c=1c = 1 is plucked at its midpoint to height h=1h = 1. (a) Find aka_k. (b) What fraction of the energy is in the fundamental? (You may use ∑k odd1/k2=π2/8\sum_{k\,\text{odd}}1/k^2 = \pi^2/8.)

Show worked solution

(a) With x0=12x_0 = \tfrac12 the formula gives ak=2sin⁡(kπ/2)k2π2⋅14=8sin⁡(kπ/2)k2π2a_k = \dfrac{2\sin(k\pi/2)}{k^2\pi^2\cdot\tfrac14} = \dfrac{8\sin(k\pi/2)}{k^2\pi^2}: zero for even kk, and a1=8/π2=0.8106a_1 = 8/\pi^2 = 0.8106, a3=−8/(9π2)a_3 = -8/(9\pi^2), and so on.

(b) Ek=14ωk2ak2=14k2π2⋅64k4π4=16π2k2E_k = \tfrac14\omega_k^2a_k^2 = \tfrac14k^2\pi^2\cdot\dfrac{64}{k^4\pi^4} = \dfrac{16}{\pi^2k^2} for odd kk. The total is 16π2⋅π28=2\dfrac{16}{\pi^2}\cdot\dfrac{\pi^2}{8} = 2, which equals the exact potential energy 12[1/12+1/12]⋅1=2\tfrac12\bigl[1/\tfrac12 + 1/\tfrac12\bigr]\cdot1 = 2. The fundamental has 16/π2=1.62116/\pi^2 = 1.621, which is 8/π2=81.1%8/\pi^2 = 81.1\% of the total.

✏️ Pen & paperFixed or free?●●○

The cosine-squared bump of width 0.20.2 centered at x=0.5x = 0.5 (height 11) is released from rest. Using u=12[F(x−t)+F(x+t)]u = \tfrac12[F(x - t) + F(x + t)] with c=1c = 1, find u(0.2,0.7)u(0.2, 0.7) for fixed ends and for free ends.

Show worked solution

The bump is nonzero only for ∣x−0.5∣<0.1\lvert x - 0.5\rvert \lt 0.1. At x=0.2x = 0.2, t=0.7t = 0.7: the arguments are x+t=0.9x + t = 0.9 and x−t=−0.5x - t = -0.5. Here F(0.9)=0F(0.9) = 0 (outside the bump). For −0.5-0.5 we need the extension: odd for fixed ends, F(−0.5)=−f(0.5)=−1F(-0.5) = -f(0.5) = -1; even for free ends, F(−0.5)=+f(0.5)=+1F(-0.5) = +f(0.5) = +1. So u=12(0−1)=−0.5u = \tfrac12(0 - 1) = -0.5 for fixed ends and +0.5+0.5 for free ends, as in the sim.

Computation

First look at the plucked string as a mode sum.

🐍 PythonLab: the plucked string from its modes
⌘/Ctrl + Enter

Now implement the leapfrog scheme itself.

🧪 Coding exerciseExercise: leapfrog for the wave equation, and the CFL limit
⌘/Ctrl + Enter

Try ν=0.5\nu = 0.5 and ν=0.8\nu = 0.8 in your solution and compare the error at the same final time: the error does not shrink as ν\nu drops, only the stability margin grows.

Key Takeaways

  • Newton’s law for a piece of string, with small slopes, gives utt=c2uxxu_{tt} = c^2u_{xx} with c=T/ρc = \sqrt{T/\rho}; for T=70T = 70 N and 4×10−44\times10^{-4} kg/m over 0.650.65 m, c=418.3c = 418.3 m/s and the fundamental is 321.8321.8 Hz.
  • Factoring the operator gives u=F(x−ct)+G(x+ct)u = F(x - ct) + G(x + ct): with no initial velocity a pulse splits into two half-height copies, with a finite speed cc (outside [0.1,0.9][0.1, 0.9] the string is exactly still at t=0.3t = 0.3).
  • Fixed ends reflect inverted (odd extension), free ends reflect upright (even extension): at x=0.2x = 0.2, t=0.7t = 0.7 the displacement is −0.5-0.5 or +0.5+0.5.
  • Separation of variables gives the normal modes sin⁡(kπx/L)cos⁡(kπct/L)\sin(k\pi x/L)\cos(k\pi ct/L) with frequencies k c/(2L)k\,c/(2L), the harmonic series; a standing wave is a pair of traveling waves.
  • A plucked string has ak∝sin⁡(kπx0)/k2a_k \propto \sin(k\pi x_0)/k^2: no Gibbs overshoot, with max error 0.0490.049 at K=10K = 10 and 0.00270.0027 at K=200K = 200; plucked at x0=1/4x_0 = 1/4, every fourth harmonic is missing.
  • Energy 12∫(ρut2+Tux2) dx\tfrac12\int(\rho u_t^2 + Tu_x^2)\,dx is exactly conserved: the quarter pluck holds 8/38/3, kinetic 16/916/9 and potential 8/98/9 at t=0.25t = 0.25.
  • Unlike heat, the wave equation has no decay, is reversible, keeps corners and has a finite signal speed.
  • Leapfrog needs ν=c Δt/Δx≤1\nu = c\,\Delta t/\Delta x \le 1; it is exact at ν=1\nu = 1, disperses at 0.80.8 (error 0.0220.022) and blows up at 1.051.05 (about 104810^{48} in 190 steps).

What comes next

This lesson used d’Alembert’s formula as a tool: to split a pulse, to reflect it, and to check the mode sum. It did not prove the pieces in the generality they deserve. 9.5 d'Alembert's Solution & Characteristics does that: the formula on an infinite line, the domain of dependence and of influence, the method of images for the end conditions (which I used here without deriving it), and the proper link from characteristics to the CFL condition. After that come forced problems, then the drum, the first place where the integer harmonics of this lesson break down. The leapfrog scheme and its dispersion get a full treatment in 10.5 Wave Equation Numerics & the CFL Condition.

Finished this lesson?

Mark it complete to track your progress (saved in this browser). Reading every section does this for you.

Where this leads

These later lessons build directly on this one: