The one-dimensional wave equation is one of the most important partial differential equations in physics. For a stretched string with uniform properties, the displacement \(y(x,t)\) satisfies
\[
\frac{\partial^2 y}{\partial t^2}=v^2\frac{\partial^2 y}{\partial x^2},
\]
where \(v\) is the wave speed. This equation says that the time-acceleration of the string at a point is determined by the local curvature of the string. Regions with strong curvature accelerate more strongly, which is why a plucked string begins to move and redistribute its shape over time.
In this calculator, the equation is solved numerically with a finite-difference method. The string is sampled at grid points \(x_i\) separated by
\[
\Delta x=\frac{L}{N_x-1},
\]
and time is advanced in steps of \(\Delta t\). The second derivatives are replaced by difference quotients, leading to the explicit update rule
\[
y_i^{n+1}=2y_i^n-y_i^{n-1}+r^2\left(y_{i+1}^n-2y_i^n+y_{i-1}^n\right),
\]
where
\[
r=\frac{v\Delta t}{\Delta x}.
\]
The quantity \(r\) is the Courant or CFL number for this scheme. For the explicit centered method used here, a common stability condition is
\[
r\le 1.
\]
If \(r\) is too large, the numerical solution can become unstable and produce unphysical growth. That is why the calculator reports the CFL value and warns you when it exceeds the usual stability limit.
To begin the simulation, you need initial conditions. The first is the starting displacement \(y(x,0)\), which can represent a pluck, a bump, or a standing-wave shape. The second is the initial velocity \(\partial y/\partial t(x,0)\), which can be zero or can include a localized kick. Once those are chosen, the solver constructs the first two time layers and then marches forward step by step.
Boundary conditions matter as well. Fixed ends impose \(y=0\) at the string endpoints, which is a standard idealization for many string instruments. Free ends instead impose zero spatial slope at the ends, meaning the endpoints are allowed to move but without a restoring slope across the boundary. These two choices produce visibly different reflected-wave patterns.
For the sample plucked-string case, take \(L=1\ \text{m}\), \(v=1\ \text{m/s}\), and a triangular initial displacement. If the snapshot time is \(t=2\ \text{s}\), the solver advances through many small time steps and then plots \(y(x,t)\). The resulting curve is the finite-difference approximation to the string shape at that moment. This is the basic numerical idea behind many vibration simulators.
The method shown here is deliberately a 1D uniform-grid model. In more advanced courses, the same logic extends to two-dimensional membranes, nonuniform strings, damping, forcing, and coupled acoustic output. But even this simple case already captures the essential connection between partial differential equations, discrete numerical schemes, and realistic vibration simulation.