Solution (source code)

= Solution
{c}

For $c>0$ and $L>0$, <D'Alembert's formula> for the <wave equation> on the full <real line> is
$$
y(x,t)=\frac{f(x-ct)+f(x+ct)}2+\frac1{2c}\int_{x-ct}^{x+ct}g(s)\,ds.
$$
For the specified initial data, define the cumulative initial-velocity <integral>
$$
A(s)=\begin{cases}
0,&s\leq-L,\\
(L^2-s^2)/2,&-L\leq s\leq0,\\
(L^2+s^2)/2,&0\leq s\leq L,\\
L^2,&s\geq L.
\end{cases}
$$
Then $\boxed{y(x,t)=[A(x+ct)-A(x-ct)]/(2c)}$. The <initial velocity> jumps at $\pm L$, so the resulting solution is interpreted piecewise classically, or as a weak wave-equation solution across the corresponding <characteristic curves>.