The pond surface is a grid of height samples u(x,y) updated every step with the discretized 2D wave equation, integrated with a leapfrog (central-difference) scheme:
u_next[i,j] = 2Ā·u[i,j] ā u_prev[i,j]
+ c² Ā· ( u[i+1,j] + u[iā1,j] + u[i,j+1] + u[i,jā1] ā 4Ā·u[i,j] )
Wave speed c sets how fast crests travel; for a continuous point source oscillating at frequency f, the emitted wavelength follows the standard dispersion relation Ī» = c / f (shown live). Pond edges use a genuine Neumann (zero-gradient) reflecting boundary ā the ghost cell just outside the domain is set equal to the edge cell, so a wavefront folds back in phase instead of vanishing. Lowering wall reflectivity blends in an absorbing sponge layer near the border that bleeds energy out, so waves fade instead of bouncing. Obstacles (single/double slit) are rigid internal walls that reflect the same way, letting you see real diffraction and interference where the slit-diffracted wavefronts overlap.
- Pebble mode ā click to drop an impulse: a single expanding ring, damped by viscosity.
- Source mode ā click to place a standing oscillator; two or more sources produce a stationary interference pattern of bright/dark fringes.
- Surface energy ā sum of squared amplitude over the grid; watch it decay under damping or drain away at low wall reflectivity.