Solution (source code)

= Solution

For the <wave equation> with wave speed one, <D'Alembert's formula> with arbitrary twice continuously differentiable initial displacement $h(x)=u(x,0)$ is
$$
u(x,t)=\frac{h(x+t)+h(x-t)}2+\frac12\int_{x-t}^{x+t}g(s)\,ds.
$$
The arbitrary <function> $h$ is essential: only the initial velocity is prescribed. For $g=0$, this gives
$$
\boxed{u(x,t)=\frac{h(x+t)+h(x-t)}2.}
$$
Both travelling terms solve the <wave equation>, and their <time derivatives> cancel at $t=0$. Conversely every classical solution has this form for its initial displacement $h$.