Solution (source code)

= Solution

At $x=0$ and $x=L$, the fixed-end <boundary conditions> require $X(0)=X(L)=0$. In the oscillatory family, the first condition removes the <cosine> term and the second requires $\sin\lambda L=0$, so $\lambda=n\pi/L$ with $n\geq1$. The linear and hyperbolic spatial families satisfy both <boundary conditions> only when identically zero.

Thus the nonzero <normal modes> and their <superposition> give
$$
\boxed{f(x,t)=\sum_{n=1}^\infty
\left[A_n\cos\frac{n\pi ct}{L}+B_n\sin\frac{n\pi ct}{L}\right]
\sin\frac{n\pi x}{L}}.
$$
For initial displacement $h(x)$ and velocity $j(x)$ compatible with the fixed ends, <orthogonality> of the <sine> functions determines
$$
A_n=\frac2L\int_0^L h(x)\sin\frac{n\pi x}{L}\,dx,\qquad
B_n=\frac{2}{n\pi c}\int_0^L j(x)\sin\frac{n\pi x}{L}\,dx.
$$
These are all the string solutions in the usual class where the series has the regularity needed to satisfy the <wave equation>.