I have the given series
$$ s_n = \frac{\sin(n\pi)}{n}, \qquad n=0,1,2,3,\dots $$
Now, as a plot, $n$ can be anything, so it would be a plot as this. But since the preconditions are that $n$ must be an integer, why is this not $0$, since $\sin n\pi=0$ when $n$ is an integer?
I ask because the following is given on a solution for a PDE:
$$ \cos(x)=u(x,0) = \sum_{n=1}^{\infty} a_n\cos(nx) \longrightarrow a_n=\begin{cases}1, & n=1\\ 0, & \text{else} \end{cases} $$
That is, the coefficient for a PDE is found by forming the Fourier integral:
$$ \cos(x)=\frac{a_n}{2\pi}\int_0^\pi \cos n x \, {\rm d} x $$
But to me, that integral is simply $0$. So how can it be $1$, for $n = 1$?
The coefficient $a_n$ of the Fourier series of $f(x)=\sum_{n=0}^\infty a_n\cos (nx)$ is given by
$$a_n=\frac{2}{\pi}\int_0^\pi\cos (nx)f(x)dx$$
In your case, $f(x)=\cos(x)$ so
$$a_n=\frac{2}{\pi}\int_0^\pi\cos (nx)\cos(x)dx$$ $$=\begin{cases} 1, & n=1\\ 0, & n\ne 1\end{cases}$$