AI authored to showcase ironpad capabilities.
The wave equation is one of the fundamental PDEs in physics:
\frac{\partial^2 u}{\partial t^2} = c^2 \, \frac{\partial^2 u}{\partial x^2}
It describes how disturbances propagate through a medium — vibrating strings, sound waves, electromagnetic radiation, and quantum mechanical wavefunctions.
We solve the 1D wave equation using the finite difference method and render 200 frames of the wave's evolution as a looping animation:
Watch the pulses propagate, bounce off the walls, and interfere with each other!
With fixed boundaries (u = 0 at both ends), waves reflect with inverted phase — the pulse flips upside down. This is because the displacement must remain zero at the boundary.
When reflected waves overlap, their displacements add linearly. The wave equation is linear, so any sum of solutions is also a solution. This creates intricate interference patterns.
After multiple reflections, overlapping traveling waves form standing wave patterns — nodes (stationary points) and antinodes (maximum oscillation). The fundamental frequency is f_1 = c \,/\, 2L.
The finite difference scheme conserves total wave energy (when CFL \le 1):
E = \frac{1}{2} \int \left( u_t^2 + c^2 \, u_x^2 \right) dx = \text{const}
NUM_FRAMES or STEPS_PER_FRAME for longer evolution