I am wondering how to find a closed-form expression for the fourier coefficients $a_n=\frac{(-1)^n}{n}$, i.e. I am looking for a function $f$ on $(-\pi,\pi)$ that generates the fourier series
$$f(x)=\sum_n \frac{(-1)^n}{n} \cos(nx)$$
What I know from this source is the fact that the function
- should be even
- should be linear because the Fourier coefficients of $x^k$ involve $\frac{1}{n^k}$.
But if $f$ is even and should be linear, it can only be a constant function. So I am not sure if it is not possible or I made a mistake.
The graph looks like a half-circle and diverges for $x = \pm \pi$ because $f(\pm \pi)=\sum_n \frac{(-1)^n}{n}$
A similar post is this.