Wave Equation
Wave Equation
The 1D wave equation governs the propagation of waves (sound, light, strings):
where is the wave speed.
d'Alembert's Solution
For an infinite domain with initial displacement and initial velocity , the general solution is:
This has a beautiful physical interpretation: the wave splits into a right-traveling copy and a left-traveling copy of the initial displacement, each at speed .
For zero initial velocity ():
Standing Waves
On a finite domain with Dirichlet boundary conditions, the normal modes are standing waves:
The angular frequencies are , giving the harmonic series of the string.
Dispersion Relation
For a non-dispersive medium, the dispersion relation is:
The phase velocity (speed of a wave crest) equals the group velocity (speed of energy transport):
Your Task
Implement dalembert(x, t, c, f_func, g_func=None) using d'Alembert's formula. If g_func is provided, integrate numerically using 100 midpoint steps; if g_func=None, use zero initial velocity. Implement standing_wave(x, t, c, L, n=1) for the -th normal mode. Implement wave_phase_velocity(omega, k) returning .