Flow Lab

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

Lesson 9.7

Nonhomogeneous Problems & Eigenfunction Expansions

Sources in the PDE, time-dependent boundary conditions, eigenfunction expansion method, Duhamel's principle.

Written byClaude Sonnet

🌊
Why this matters for simulation: Body forces (gravity, buoyancy) are sources in the momentum equation.

By the end of this lesson you can…

  • Expand $u(x,t)$ in the eigenfunctions of the spatial operator and derive the mode equations $a_k' + \lambda_k a_k = f_k(t)$ (heat) and $a_k'' + \omega_k^2 a_k = f_k(t)$ (wave).
  • Solve each mode by Duhamel's principle, and split the heat solution into a steady state plus a transient.
  • Explain resonance: forcing at a mode frequency gives amplitude growing linearly in $t$; say which force shapes excite which modes, and what damping does.
  • Handle time-dependent boundary values by writing $u = v + x\,g(t)$ and find the extra source term for the heat and the wave equation.
  • Say honestly how fast the expansions of a localized source and of its solution converge, and compare with a method-of-lines run.
On this page
·
  1. Diagonalize the spatial operator
  2. One ODE per mode: Duhamel
  3. Example: a heated rod with a localized source
  4. Convergence: honest limits of the expansion
  5. The same problem by the method of lines
  6. Forced vibrations and resonance
  7. Time-dependent boundary data
  8. Check your understanding
  9. Problems
  10. Computation
  11. Key Takeaways
  12. What comes next

9.3 Solving the Heat Equation: Separation of Variables and 9.4 The Wave Equation & Vibrating Strings solved the bare equations, and 9.5 d'Alembert's Solution & Characteristics added a source on an infinite line. Real sources oscillate, boundaries move, and heat has no characteristics to follow. One idea handles all of it, the one you used in 7.6 Nonhomogeneous Linear Systems: change to the coordinates in which the operator is diagonal. A PDE with a source then becomes a list of independent ODEs with sources, and it also explains resonance, the reason a bridge, an organ pipe or a wing panel can be shaken apart by a small force at the wrong frequency.

▶ Video A source projected onto the modes, each mode driven as its own ODE, the steady state and the transient, resonance as linear growth, and a moving end as an extra sourcecaptions only
Transcript
  1. Along the eigenvectors of a symmetric matrix, a forced system falls apart into scalar equations. On a rod with zero ends, minus d x x plays the matrix, with eigenvectors sine of k pi x. So expand the temperature and the source in sines, with coefficients that depend on time. Each sine is multiplied by minus lambda k, so matching coefficients gives one ODE per mode: for heat, a k prime plus lambda k a k equals f k; for the wave equation, a k double prime plus omega k squared a k equals f k.
  2. Heat a rod on the middle part, from 0.4 to 0.6, at unit rate, with the ends held at zero and the rod cold. The box is symmetric about the middle, so the even modes vanish. The first coefficient is 0.3935, then f 3 is minus 0.3434, and f 5 is 0.2546. They alternate in sign and fall off slowly.
  3. Each mode is solved by Duhamel's principle. For a source held on, a k is f k over lambda k times one minus e to the minus lambda k t. The sum splits into a steady state, where conduction balances the source, minus a transient of decaying modes. Mode one alone gives 0.02501 at time 0.1. At the midpoint the temperature is 0.02062, 0.03014, 0.03946 and 0.04294 at times 0.05, 0.1, 0.2 and 0.3, and reaches 0.04500 at time 1.
  4. How many modes do we need? At time 1, one mode gives 0.03986, 11 percent low. Three modes give 0.04373, off by 2.8 percent. Five give 0.04476, within 0.5 percent of 0.04500. The solution's coefficients carry an extra one over lambda k, so they fall like one over k cubed, and a few modes are enough.
  5. The source itself is another matter. The box has jumps, so its sine series overshoots, the Gibbs effect. The largest value is 1.124 with 20 modes, 1.101 with 50, 1.092 with 200: the overshoot does not shrink, it only narrows. A point source is worse, its coefficients do not decay at all. Yet the solution is a tent with a corner of height 0.21, and the error there falls only like one over N. At x equals 0.3, N of 1, 5, 20 and 200 gives 0.1326, 0.1931, 0.2049 and 0.2095. Heat has a decay factor to help; the wave equation does not.
  6. You can skip the eigenfunctions: put 50 grid points on the rod, replace u x x by a central difference, and march with Runge Kutta. This is the method of lines, and it agrees with the modal sum to 8 times 10 to the minus 6. The reason is that the grid operator's eigenvectors are exactly sines, with slightly wrong eigenvalues: 9.8664 against pi squared, 9.8696. The largest is 9990, about 1000 times the smallest, so the system is stiff.
  7. Now the wave equation, forced by sine pi x times cosine omega t. Each mode obeys a double prime plus omega k squared a equals f cosine omega t. Away from a natural frequency the response stays bounded. At omega equal to pi the limit is t sine pi t over 2 pi: the amplitude grows linearly, each push arriving at the right moment, like a child on a swing. The midpoint reaches 1.512 at time 9.5, under the envelope t over 2 pi, which is 1.592 at time 10.
  8. Detune to 0.9 pi and the amplitude stays finite, 1.067, reached at half a beat period, time 10. Drive at 2 pi, the second mode, and the peak is only 0.0675: the force sine pi x is symmetric, mode 2 is antisymmetric, so its coefficient is zero. Resonance needs both the frequency and the shape. With damping, gamma 0.5, the growth saturates: the largest midpoint value is 0.316, against the limit 0.318. Damping caps the amplitude but does not remove the danger.
  9. Now let the right end move. Sines vanish at x equals 1, so subtract a moving line: u equals v plus x g of t. The curvature of x g is zero, but its time derivative is left over as a source, minus x g prime for heat, minus x g double prime for the wave. For heat at omega 10 pi, the source is large but the effect is small: the midpoint only ranges between 0.360 and 0.640, and at x equals 0.1 between 0.079 and 0.121. Conduction cannot follow a fast wiggle. Shake a string's end at its fundamental, and the extra force has frequency omega one: at time 9.5 the middle has swung to 10.
  10. To recap. Each mode obeys its own ODE with the projected source, and Duhamel gives a steady state plus a transient. A force that meets a mode in frequency and shape grows linearly, and damping caps it. A moving end is an extra source. Next: membranes and drums, where the eigenfunctions stop being plain sines.

Diagonalize the spatial operator

For a symmetric matrix AA, the eigenvectors are perpendicular directions along which AA only stretches. Write a vector in those directions and y′=−Ay+q\mathbf{y}' = -A\mathbf{y} + \mathbf{q} falls apart into scalar equations. On 0<x<10 \lt x \lt 1 with u=0u = 0 at both ends, −∂x2-\partial_x^2 plays the part of the matrix: its eigenvectors are sin⁡(kπx)\sin(k\pi x) with eigenvalues λk=(kπ)2\lambda_k = (k\pi)^2 (8.2 Eigenvalue Problems & Sturm–Liouville Theory), perpendicular in the sense ∫01sin⁡(jπx)sin⁡(kπx) dx=0\int_0^1\sin(j\pi x)\sin(k\pi x)\,dx = 0 for j≠kj \ne k. “Writing in those directions” is the sine series of 8.3 Fourier Series.

Take the forced heat equation, with α=L=1\alpha = L = 1 (time in units of L2/αL^2/\alpha):

ut=uxx+q(x,t),u(0,t)=u(1,t)=0,u(x,0)=0.u_t = u_{xx} + q(x,t),\qquad u(0,t) = u(1,t) = 0,\qquad u(x,0) = 0 .

Expand both the unknown and the source in the sines, with coefficients that depend on time:

u(x,t)=∑k≥1ak(t)sin⁡kπx,q(x,t)=∑k≥1fk(t)sin⁡kπx,fk(t)=2∫01q(x,t)sin⁡kπx dx.u(x,t) = \sum_{k\ge1} a_k(t)\sin k\pi x,\qquad q(x,t) = \sum_{k\ge1} f_k(t)\sin k\pi x,\qquad f_k(t) = 2\int_0^1 q(x,t)\sin k\pi x\,dx .

Every term satisfies the end conditions. Substitute into the PDE. Since ∂x2sin⁡kπx=−λksin⁡kπx\partial_x^2\sin k\pi x = -\lambda_k\sin k\pi x, matching the coefficient of each sine gives

ak′(t)+λk ak(t)=fk(t),ak(0)=0.a_k'(t) + \lambda_k\,a_k(t) = f_k(t),\qquad a_k(0) = 0 .

The wave equation utt=uxx+F(x,t)u_{tt} = u_{xx} + F(x,t) (with c=1c = 1) goes the same way and yields

ak′′(t)+ωk2 ak(t)=fk(t),ak(0)=ak′(0)=0,ωk=kπ.a_k''(t) + \omega_k^2\,a_k(t) = f_k(t),\qquad a_k(0) = a_k'(0) = 0,\qquad \omega_k = k\pi .

This is the whole eigenfunction expansion method: project the source onto the modes, solve one ODE per mode, add up.

One ODE per mode: Duhamel

The mode equations are the linear ODEs of 3.4 Linear First-Order Equations & Integrating Factors and 5.5 Variation of Parameters. Treat the force as a train of small kicks. A kick at time ss decays as e−λk(t−s)e^{-\lambda_k(t-s)} for heat and rings as sin⁡ωk(t−s)/ωk\sin\omega_k(t-s)/\omega_k for the wave (5.6 Forced Oscillations & Resonance), so

ak(t)=∫0te−λk(t−s)fk(s) ds(heat),ak(t)=1ωk∫0tsin⁡ωk(t−s) fk(s) ds(wave).a_k(t) = \int_0^t e^{-\lambda_k(t-s)}f_k(s)\,ds\quad\text{(heat)},\qquad a_k(t) = \frac{1}{\omega_k}\int_0^t \sin\omega_k(t-s)\,f_k(s)\,ds\quad\text{(wave)}.

This is Duhamel’s principle again, now one mode at a time on a bounded rod. The payoff for a source that is switched on at t=0t = 0 and then held, fk(t)=fkf_k(t) = f_k:

ak(t)=fkλk(1−e−λkt),u(x,t)=∑kfkλksin⁡kπx⏟steady state  −  ∑kfkλke−λktsin⁡kπx⏟transient.a_k(t) = \frac{f_k}{\lambda_k}\bigl(1 - e^{-\lambda_k t}\bigr),\qquad u(x,t) = \underbrace{\sum_k\frac{f_k}{\lambda_k}\sin k\pi x}_{\text{steady state}}\;-\;\underbrace{\sum_k\frac{f_k}{\lambda_k}e^{-\lambda_k t}\sin k\pi x}_{\text{transient}} .

The first sum solves 0=uxx+q0 = u_{xx} + q, the balance between conduction and the source: a steady state. The second is a sum of decaying modes, exactly the object of 9.3 Solving the Heat Equation: Separation of Variables, and each mode returns to rest at its own rate e−λkte^{-\lambda_k t}. The slowest mode, with time constant 1/π2=0.10131/\pi^2 = 0.1013, sets the settling time.

Example: a heated rod with a localized source

Let a heater warm the part 0.4<x<0.60.4 \lt x \lt 0.6 of the rod at unit rate, q=1q = 1 there and 00 elsewhere, with the ends held at zero and the rod cold at t=0t = 0. The sim’s midpoint rule gives the first coefficient f1=2∫0.40.6sin⁡πx dx=0.3935f_1 = 2\int_{0.4}^{0.6}\sin\pi x\,dx = 0.3935. The box is symmetric about x=1/2x = 1/2 and even modes are odd about the middle, so they vanish; f3=−0.3434f_3 = -0.3434, f5=0.2546f_5 = 0.2546, and the first mode alone has

a1(t)=0.3935π2(1−e−π2t),a1(0.1)=0.02501.a_1(t) = \frac{0.3935}{\pi^2}\bigl(1 - e^{-\pi^2 t}\bigr),\qquad a_1(0.1) = 0.02501 .

At the midpoint x=1/2x = 1/2 the temperature climbs as u(0.5,t)=0.02062, 0.03014, 0.03946, 0.04294u(0.5, t) = 0.02062,\ 0.03014,\ 0.03946,\ 0.04294 at t=0.05, 0.1, 0.2, 0.3t = 0.05,\ 0.1,\ 0.2,\ 0.3 (the sine sum with 200 modes), and has reached 0.045000.04500 at t=1t = 1, the steady state. By hand, the steady state is ∫01G(12,y)q(y) dy=0.045\int_0^1 G(\tfrac12,y)q(y)\,dy = 0.045, where G(x,y)=x(1−y)G(x,y) = x(1 - y) for x≤yx \le y and y(1−x)y(1 - x) for x≥yx \ge y is the response at xx to a unit point source at yy, the Green’s function of the rod. Its sine series, G=∑k(2/λk)sin⁡kπx sin⁡kπyG = \sum_k (2/\lambda_k)\sin k\pi x\,\sin k\pi y, is what the formula above gives for a point source. At t=1t = 1:

modes kept NNu(0.5,1)u(0.5, 1)error
10.0398611%
30.043732.8%
50.044760.5%
◆ Interactive Forced heat and wave on a rod: modal solution against the method of lines; drive by a source or a moving end

Loading simulation…

What to try. Heat with the box source: move the time index, lower NN to 11 and 33, then switch to the point source and watch the kink. Wave with the mode-1 shape: press the Ω=π\Omega = \pi button.

Convergence: honest limits of the expansion

Two different series are in play and they converge at very different speeds.

The source. The box has jumps, so its sine coefficients fall only like 1/k1/k and its series shows the Gibbs overshoot of 8.5 Convergence & the Gibbs Phenomenon. The sim sums the series for the unit box and records its largest value: 1.1241.124 with N=20N = 20 modes, 1.1011.101 with 5050 and 1.0921.092 with 200200. The overshoot does not shrink, it only narrows; the limit is about 9%9\% of the jump (from memory). A point source is worse: its coefficients 2sin⁡(0.3kπ)2\sin(0.3k\pi) do not decay, so its series is not a function.

The solution. Nobody sums the source series. The solution’s coefficients are fk/λkf_k/\lambda_k, and dividing by k2k^2 buys two powers of kk. For the box they fall like 1/k31/k^3 and the sums above converge quickly with no overshoot. For the point source they fall like 1/k21/k^2, like the plucked string of 9.4 The Wave Equation & Vibrating Strings: the steady state is the tent G(x,0.3)G(x, 0.3), with a corner of height 0.3×0.7=0.210.3 \times 0.7 = 0.21, and the error of the NN-mode sum at the corner shrinks like 1/N1/N:

NN1520200
u(0.3,1)u(0.3, 1)0.13260.19310.20490.2095

Even 200200 modes miss the corner by 5×10−45\times10^{-4}. Heat gets extra help from the factor e−λkte^{-\lambda_k t}, which kills high modes after any positive time; the wave equation has no such factor, and a corner stays a corner.

The same problem by the method of lines

You can also put nn grid points on the rod, replace uxxu_{xx} by the central difference and march the ODE system with RK4 (4.3 Runge–Kutta Methods & Butcher Tableaux): the method of lines. The sim does this with n=50n = 50 and Δt=10−4\Delta t = 10^{-4} beside the modal sum. At t=0.1t = 0.1 both give 0.030140.03014 at the midpoint, and over the whole run they never differ by more than 8×10−68\times10^{-6}.

The agreement has a reason. The discrete operator is a symmetric 49×4949\times49 matrix whose eigenvectors are exactly sin⁡(kπxj)\sin(k\pi x_j), with eigenvalues (4/Δx2)sin⁡2(kπΔx/2)(4/\Delta x^2)\sin^2(k\pi\Delta x/2) (from memory, a standard fact that I checked numerically). For k=1k = 1 that is 9.86649.8664 against π2=9.8696\pi^2 = 9.8696: the method of lines is the eigenfunction method with a slightly wrong list of eigenvalues. The largest eigenvalue is 99909990, about 10001000 times the smallest, so the system is stiff (4.5 Stability Regions & Stiffness): RK4 needs Δt<2.8/9990=2.8×10−4\Delta t \lt 2.8/9990 = 2.8\times10^{-4}, set by the finest grid mode. The modal method has no such limit, but you must know the eigenfunctions. For the resonant string below, the two differ by at most 1.0×10−31.0\times10^{-3} over the run (peaks near 1.51.5), because the grid’s lowest frequency is 3.141463.14146 rather than π\pi and the phase drifts slowly: numerical dispersion, the subject of 10.5 Wave Equation Numerics & the CFL Condition.

Forced vibrations and resonance

Now the wave equation, utt=uxx+F(x)cos⁡Ωtu_{tt} = u_{xx} + F(x)\cos\Omega t on a string of length 11 with fixed ends and c=1c = 1, so that ωk=kπ\omega_k = k\pi. A source with this time dependence gives the mode equation ak′′+ωk2ak=fkcos⁡Ωta_k'' + \omega_k^2a_k = f_k\cos\Omega t, where fkf_k is the sine coefficient of FF. For Ω≠ωk\Omega \ne \omega_k the solution with ak(0)=ak′(0)=0a_k(0) = a_k'(0) = 0 is

ak(t)=fk cos⁡Ωt−cos⁡ωktωk2−Ω2.a_k(t) = f_k\,\frac{\cos\Omega t - \cos\omega_kt}{\omega_k^2 - \Omega^2}.

It is bounded: a response at the driving frequency plus a free oscillation at the natural one. When Ω\Omega is close to ωk\omega_k the denominator is small and the amplitude large, a fast oscillation inside a slow envelope (beats). At Ω=ωk\Omega = \omega_k the limit (Problem 2) is

ak(t)=fk t sin⁡ωkt2ωk,a_k(t) = \frac{f_k\,t\,\sin\omega_kt}{2\omega_k},

an oscillation whose amplitude grows linearly without bound. That is resonance: each push arrives at the right moment in the cycle, like a child on a swing.

Numbers from the sim (force shape sin⁡πx\sin\pi x, f1=1f_1 = 1, response at the midpoint, run to t=10t = 10):

Ω\Omegawhat happenslargest ∣u(0.5,t)∣\lvert u(0.5,t)\rvert
π\piresonance, tsin⁡(πt)/2πt\sin(\pi t)/2\pi1.512 at t=9.5t = 9.5
0.9π0.9\pibeats, bound 2/(π2−Ω2)2/(\pi^2 - \Omega^2)1.067
2π2\pinot a resonance here0.0675

At resonance the envelope t/2πt/2\pi is 1.5921.592 at t=10t = 10, and the sampled peak at t=9.5t = 9.5 is 9.5/2π=1.5129.5/2\pi = 1.512. At 0.9π0.9\pi the amplitude is finite but 1.0671.067 is already large, and it is reached at half a beat period, t=π/(π−Ω)=10t = \pi/(\pi - \Omega) = 10, the end of this run. At 2π2\pi the mode-2 frequency is hit, yet nothing resonates: sin⁡πx\sin\pi x is symmetric about the middle, mode 2 is antisymmetric, so f2=0f_2 = 0. Resonance needs both the frequency and the shape. A unit point force at x0=0.3x_0 = 0.3 has f1=2sin⁡(0.3π)f_1 = 2\sin(0.3\pi) and gives 2.4462.446 at t=9.5t = 9.5, while the box on [0.4,0.6][0.4, 0.6] gives 0.5950.595 because its f1f_1 is only 0.39350.3935.

Damping. With loss, a′′+2γa′+ω2a=fcos⁡Ωta'' + 2\gamma a' + \omega^2a = f\cos\Omega t, resonance grows for a while and saturates at f/(2γω)f/(2\gamma\omega). For γ=0.5\gamma = 0.5 and the sin⁡πx\sin\pi x force the sim’s largest midpoint value is 0.3160.316 against the limit 1/(2γπ)=0.3181/(2\gamma\pi) = 0.318. Damping caps the amplitude but does not remove the danger.

Why it matters. Bridge decks, organ pipes and wing panels are elastic or acoustic systems with a list of ωk\omega_k and light damping (from memory). The Tacoma Narrows collapse is usually attributed to aeroelastic flutter, where the wind’s force depends on the motion, not to simple resonance with an outside force (from memory). The practice is the same: compute the ωk\omega_k, keep known forcing frequencies away from them, add damping. An organ pipe is the useful case, an air column driven at its mode.

Time-dependent boundary data

Now let the right end move: u(0,t)=0u(0,t) = 0, u(1,t)=g(t)u(1,t) = g(t). Every sin⁡kπx\sin k\pi x vanishes at x=1x = 1, so a sum of them cannot hit g(t)g(t). 9.3 Solving the Heat Equation: Separation of Variables subtracted a steady straight line for constant ends. The same move works when gg varies, if you remember that the subtracted function now depends on time:

u(x,t)=v(x,t)+x g(t),v(0,t)=v(1,t)=0.u(x,t) = v(x,t) + x\,g(t),\qquad v(0,t) = v(1,t) = 0 .

Since ∂x2(x g)=0\partial_x^2(x\,g) = 0, vv obeys the same spatial operator, but the time derivative of x g(t)x\,g(t) is left over and becomes a new source:

heat:vt=vxx−x g′(t),wave:vtt=vxx−x g′′(t).\text{heat:}\quad v_t = v_{xx} - x\,g'(t),\qquad\qquad \text{wave:}\quad v_{tt} = v_{xx} - x\,g''(t).

(Constant gg adds nothing: the old trick.) Project xx onto the sines: 2∫01xsin⁡kπx dx=bk=2(−1)k+1/(kπ)2\int_0^1x\sin k\pi x\,dx = b_k = 2(-1)^{k+1}/(k\pi), so mode kk is driven by fk(t)=−bk g′(t)f_k(t) = -b_k\,g'(t) or −bk g′′(t)-b_k\,g''(t). Choose g(0)=g′(0)=0g(0) = g'(0) = 0 so that vv starts at rest; the sim uses g(t)=1−cos⁡Ωtg(t) = 1 - \cos\Omega t.

Heat, oscillating end. Take Ω=10π\Omega = 10\pi: the right end swings between 00 and 22 five times per unit of time. The source is large (f1f_1 has size 2020) but its effect is small: over 0.8≤t≤10.8 \le t \le 1, u(0.5,t)u(0.5, t) ranges between 0.3600.360 and 0.6400.640, a swing of ±0.14\pm0.14 about the mean 0.50.5, and at x=0.1x = 0.1 only between 0.0790.079 and 0.1210.121. The oscillation does not penetrate: heat conduction cannot follow a fast wiggle, so the signal dies out as it enters, roughly like e−Ω/2 de^{-\sqrt{\Omega/2}\,d} at the distance dd from the moving end (the thermal skin depth, from memory; an exact frequency-domain calculation gives the amplitudes 0.13960.1396 at x=0.5x = 0.5 and 0.02130.0213 at x=0.1x = 0.1). Viscous flow over an oscillating plate behaves the same way.

Wave, shaken end. Shake the right end of a string at its fundamental, g(t)=1−cos⁡πtg(t) = 1 - \cos\pi t. The extra force −b1g′′=−2πcos⁡πt-b_1g'' = -2\pi\cos\pi t has frequency ω1\omega_1, so mode 1 is driven at resonance and a1=−tsin⁡πta_1 = -t\sin\pi t. Adding x g=0.5 (1−cos⁡πt)x\,g = 0.5\,(1 - \cos\pi t) at the midpoint, at t=9.5t = 9.5 the sim gives u(0.5,9.5)=10.0u(0.5, 9.5) = 10.0: the middle of the string, driven by an end that moves only between 00 and 22, has swung 1010 units. A moving boundary is a resonant force like any other.

Check your understanding

✅ Concept check

For $u_t = u_{xx} + q(x,t)$ on $0 \lt x \lt 1$ with zero ends, what equation does the coefficient $a_k(t)$ of $\sin k\pi x$ obey?

✅ Concept check

A string of length $1$ ($c = 1$) is driven by a point force at its midpoint $x = 1/2$ at the angular frequency $\Omega = 2\pi$ (the second natural frequency). What happens?

✅ Concept check

The rod $u_t = u_{xx} + \sin\pi x$ has zero ends and starts cold. What is $u(1/2, t)$ as $t \to \infty$? (Hint: only mode 1 is driven.)

✅ Concept check

The wave equation $u_{tt} = u_{xx}$ has $u(0,t) = 0$ and $u(1,t) = g(t)$. Writing $u = v + x\,g(t)$ with $v = 0$ at both ends, which source appears in the equation for $v$?

Problems

✏️ Pen & paperA heated rod with a sine source●○○

The rod ut=uxx+3sin⁡2πxu_t = u_{xx} + 3\sin 2\pi x (0<x<10 \lt x \lt 1) has zero end temperatures and u(x,0)=0u(x,0) = 0. Find u(x,t)u(x,t) and the steady state, and state the relaxation time.

Show worked solution

The source is exactly mode 2, so f2=3f_2 = 3 and all other fk=0f_k = 0. The mode equation is a2′+4π2a2=3a_2' + 4\pi^2a_2 = 3, with a2(0)=0a_2(0) = 0, so a2=34π2(1−e−4π2t)a_2 = \dfrac{3}{4\pi^2}\bigl(1 - e^{-4\pi^2t}\bigr) and u=34π2(1−e−4π2t)sin⁡2πxu = \dfrac{3}{4\pi^2}\bigl(1 - e^{-4\pi^2t}\bigr)\sin 2\pi x. The steady state is 34π2sin⁡2πx≈0.0760sin⁡2πx\dfrac{3}{4\pi^2}\sin 2\pi x \approx 0.0760\sin 2\pi x, reached with time constant 1/4π2=0.02531/4\pi^2 = 0.0253. All other modes stay at zero.

✏️ Pen & paperResonance as a limit●●○

Start from a(t)=f (cos⁡Ωt−cos⁡ωt)/(ω2−Ω2)a(t) = f\,(\cos\Omega t - \cos\omega t)/(\omega^2 - \Omega^2), the solution of a′′+ω2a=fcos⁡Ωta'' + \omega^2a = f\cos\Omega t with zero initial data. Take Ω→ω\Omega \to \omega to derive a=f tsin⁡ωt/(2ω)a = f\,t\sin\omega t/(2\omega). Then, for ω=π\omega = \pi and f=1f = 1, find the amplitude envelope at t=10t = 10.

Show worked solution

Use cos⁡Ωt−cos⁡ωt=2sin⁡(ω+Ω)t2sin⁡(ω−Ω)t2\cos\Omega t - \cos\omega t = 2\sin\tfrac{(\omega+\Omega)t}{2}\sin\tfrac{(\omega-\Omega)t}{2} and ω2−Ω2=(ω−Ω)(ω+Ω)\omega^2 - \Omega^2 = (\omega-\Omega)(\omega+\Omega). Then

a=f 2sin⁡(ω+Ω)t2ω+Ω⋅sin⁡(ω−Ω)t2ω−Ω.a = f\,\frac{2\sin\frac{(\omega+\Omega)t}{2}}{\omega+\Omega}\cdot\frac{\sin\frac{(\omega-\Omega)t}{2}}{\omega-\Omega}.

As Ω→ω\Omega \to \omega, the first factor tends to sin⁡(ωt)/ω\sin(\omega t)/\omega and, since sin⁡(ϵt/2)/ϵ→t/2\sin(\epsilon t/2)/\epsilon \to t/2, the second to t/2t/2. So a→f tsin⁡ωt/(2ω)a \to f\,t\sin\omega t/(2\omega). For ω=π\omega = \pi the envelope is t/2πt/2\pi, which is 10/2π=1.591510/2\pi = 1.5915 at t=10t = 10.

✏️ Pen & paperA ramped end and its steady profile●●●

The rod ut=uxxu_t = u_{xx} has u(0,t)=0u(0,t) = 0, u(1,t)=tu(1,t) = t and u(x,0)=0u(x,0) = 0. (a) Write u=v+x tu = v + x\,t and find the equation, end conditions and initial data of vv. (b) Find the coefficient a1(t)a_1(t) of the first mode of vv. (c) Find the exact long-time profile of vv and compare its midpoint value with the first mode alone.

Show worked solution

(a) vt=ut−x=vxx−xv_t = u_t - x = v_{xx} - x (since x tx\,t has no curvature), with v(0,t)=v(1,t)=0v(0,t) = v(1,t) = 0 and v(x,0)=0v(x,0) = 0. The source is q=−xq = -x, a time-independent source, with g′=1g' = 1.

(b) The coefficient of xx is b1=2/πb_1 = 2/\pi, so f1=−2/πf_1 = -2/\pi and a1′+π2a1=−2/πa_1' + \pi^2a_1 = -2/\pi, giving a1=−2π3(1−e−π2t)a_1 = -\dfrac{2}{\pi^3}\bigl(1 - e^{-\pi^2t}\bigr), with limit −2/π3=−0.0645-2/\pi^3 = -0.0645.

(c) The steady state satisfies 0=v′′−x0 = v'' - x, so v=x3/6+cxv = x^3/6 + cx, and v(1)=0v(1) = 0 gives c=−1/6c = -1/6: v∞=(x3−x)/6v_\infty = (x^3 - x)/6. At x=1/2x = 1/2 it is (0.125−0.5)/6=−0.0625(0.125 - 0.5)/6 = -0.0625. The first mode alone gives −0.0645-0.0645, 3%3\% too large in magnitude: one mode already captures the profile. So u→x t+(x3−x)/6u \to x\,t + (x^3 - x)/6.

Computation

A smooth source q=e−((x−0.5)/0.1)2q = e^{-((x - 0.5)/0.1)^2} on the cold rod, solved twice: by the modal formula and by the method of lines.

🐍 PythonLab: modal solution against method of lines
⌘/Ctrl + Enter

Now implement the mode machinery yourself.

🧪 Coding exerciseExercise: coefficients, mode ODEs and the sum
⌘/Ctrl + Enter

Try the point-source error by hand: replace the source by the coefficients 2sin⁡(0.3kπ)2\sin(0.3k\pi) and see how the error at x=0.3x = 0.3 falls with NN.

Key Takeaways

  • Expanding in the eigenfunctions of the spatial operator turns ut=uxx+qu_t = u_{xx} + q into independent ODEs ak′+λkak=fk(t)a_k' + \lambda_ka_k = f_k(t), and utt=uxx+Fu_{tt} = u_{xx} + F into ak′′+ωk2ak=fk(t)a_k'' + \omega_k^2a_k = f_k(t), with fkf_k the projection of the source.
  • Each mode is solved by Duhamel; a held source gives the steady state ∑(fk/λk)sin⁡kπx\sum (f_k/\lambda_k)\sin k\pi x minus a transient. For the box source the rod’s midpoint reaches 0.045000.04500, with 0.039860.03986, 0.043730.04373 and 0.044760.04476 from 11, 33 and 55 modes.
  • The box source’s own series overshoots by about 9%9\% (peak 1.1241.124, 1.1011.101, 1.0921.092 at N=20,50,200N = 20, 50, 200), but the solution’s coefficients carry an extra 1/λk1/\lambda_k and converge fast. A point source leaves a corner with error about 1/N1/N (0.20950.2095 against 0.210.21 at N=200N = 200).
  • Resonance: forcing at ωk\omega_k gives ak=fktsin⁡ωkt/(2ωk)a_k = f_kt\sin\omega_kt/(2\omega_k), growing linearly (peak 1.5121.512 at t=9.5t = 9.5 for Ω=π\Omega = \pi); detuning to 0.9π0.9\pi gives beats of size 1.0671.067; a force orthogonal to a mode cannot excite it; damping saturates the growth at f/(2γω)f/(2\gamma\omega).
  • A moving end u(1,t)=g(t)u(1,t) = g(t) is handled by u=v+x g(t)u = v + x\,g(t), which adds the source −x g′-x\,g' (heat) or −x g′′-x\,g'' (wave). A fast heat wiggle stays near the wall (±0.14\pm0.14 at x=0.5x = 0.5 for Ω=10π\Omega = 10\pi); a string shaken at its fundamental reaches 10.010.0 at the midpoint by t=9.5t = 9.5.
  • The method of lines is the same expansion with grid eigenvalues: it matched the modal answer to 8×10−68\times10^{-6} for the rod and 1.0×10−31.0\times10^{-3} for the resonant string, at the price of a stiffness ratio near 10001000.

What comes next

Everything here lived on a line, where the eigenfunctions are sines and the frequencies are kπk\pi. A drum is a two-dimensional region, and 9.8 Higher Dimensions: Membranes & Drums carries this lesson over to rectangles and disks. The eigenfunctions stop being plain sines: on a rectangle they are products of sines, and on a disk they involve the Bessel functions of 8.6 Orthogonal Polynomials & Special Functions, whose zeros are not evenly spaced, so a drum has no clear pitch. The method of this lesson (project the source, one ODE per mode, resonance when a force meets a mode in frequency and shape) then goes through unchanged. Closed-form eigenfunctions exist only for special shapes such as these; for an arbitrary region they must be computed numerically.

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: