〰️ Wave Equation
Wave equation simulation: pluck a virtual string or drum membrane and explore transverse waves, standing modes, dispersion and 2D interference.
〰️ Wave Equation — 2D Simulation
The 2D wave equation solved numerically on a grid. Drop disturbances and watch waves propagate, reflect off boundaries and interfere. Visualise standing waves, diffraction and superposition.
🔬 What It Demonstrates
Finite difference method solves ∂²u/∂t² = c²∇²u on a discrete grid. Boundary conditions can be fixed (reflecting) or absorbing (open).
🎮 How to Use
Click to create disturbances. Watch waves propagate outward, reflect from walls and interfere. Add slits to observe diffraction patterns.
💡 Did You Know?
The wave equation was first studied by d'Alembert in 1747 for vibrating strings. It describes sound, water waves, seismic waves and electromagnetic radiation — one equation for all wave phenomena.
About this simulation
This simulation integrates the classical wave equation, ∂²u/∂t² = c²∇²u, in real time using an explicit finite-difference leapfrog scheme. You can switch between a 1D plucked string of 600 points and a 2D drum membrane on a 100×100 grid, both with fixed (reflecting) ends. Because each step interferes the forward and reflected waves, you can watch standing waves, harmonics and 2D ripple interference emerge from one simple update rule.
🔬 What it shows
The discretised wave equation: each grid point's next displacement is found from its current and previous values plus the curvature of its neighbours, scaled by r = c². The string uses the 1D Laplacian (u[i-1] - 2u[i] + u[i+1]); the membrane uses the 4-neighbour 2D Laplacian. A damping factor multiplies each step so energy gradually decays.
🎮 How to use
Toggle "String 1D" or "Membrane 2D". Click or drag on the canvas to inject a Gaussian disturbance. The Speed slider (1–20) sets the wave speed c, and Damping (0–50) sets energy loss per step. Use "Pluck" for a single impulse, "Continuous" to drive the string sinusoidally, the Mode menu to launch a pure 1st–4th harmonic, and Reset to clear the field.
💡 Did you know?
The wave equation was first written down by Jean le Rond d'Alembert in 1747 to describe a vibrating string. Its solutions split into left- and right-travelling waves, and the same equation governs sound, light, water ripples and seismic waves alike.
Frequently asked questions
What is the wave equation this simulation solves?
It solves the classical second-order wave equation, ∂²u/∂t² = c²∇²u, where u is the transverse displacement and c is the wave speed. In the string mode the Laplacian is one-dimensional; in the membrane mode it is two-dimensional. The same equation describes a guitar string, a drum skin, sound and many other waves.
How does the numerical method work?
It uses an explicit finite-difference leapfrog scheme. Time and space are split into a grid, and each point's next value is computed as 2u(now) - u(previous) + r times the discrete Laplacian, with r = c². This three-time-level update is the standard second-order accurate way to march the wave equation forward in time.
What do the Speed and Damping sliders do?
Speed sets the wave propagation constant c that scales the stiffness term r = c², so higher values make waves travel and oscillate faster. Damping applies a multiplicative factor just below 1 to every step, draining energy so the vibration slowly dies away, much like air resistance and internal friction in a real string or membrane.
Are the standing waves and harmonics physically accurate?
Qualitatively, yes. The ends are held fixed, so reflections produce standing waves whose nodes match real harmonics, and selecting a mode launches a clean sine profile sin(nπx/L). It is an idealised model, however: it ignores string stiffness and dispersion, and very high speeds can exceed the scheme's stability limit and distort the result.
Why does a single pluck turn into a standing wave?
A localised pluck is a superposition of waves travelling both ways along the string. When each reaches a fixed end it reflects with inverted phase, and the forward and reflected waves repeatedly interfere. Only wavelengths that fit the boundary survive constructively, so the chaotic initial pulse settles into the resonant standing-wave pattern you see.
1D string and 2D membrane wave PDEs solved via finite differences. Pluck the string or tap the membrane and watch standing waves, modes and interference patterns.
3D · Three.js / WebGL renderer · 60 FPS target · runs fully client-side, no install