Solution (source code)

= Solution

Fixed endpoints select sine <normal modes> with $k_n=n\pi/L$ and $\omega_n=vk_n$. The product identity $\sin z\cos z=\tfrac12\sin2z$ decomposes the held initial profile into $n=2$ and $n=4$, with amplitudes $1$ and $1/2$. Zero initial velocity selects cosine time dependence. Therefore
$$
\boxed{y(x,t)=\sin\frac{2\pi x}L\cos\frac{2\pi vt}L+\frac12\sin\frac{4\pi x}L\cos\frac{4\pi vt}L.}
$$
Both endpoints vanish at every time. At $t=0$ the product-form displacement is recovered and $y_t=0$. The implicit leading displacement amplitude is one in the source's chosen length units; including a physical amplitude $A$ multiplies the whole solution by $A$.