I am having some issues understanding Fourier series and I am stuck trying to solve a problem.
So the function $u$ has period $2\pi$ and is defined as
$$u(x) = \begin{cases} 1 & 0 \leq x \lt \pi \\ 0 & \pi \leq x \lt 2\pi \\ \end{cases}, $$ And I should determine the Fourier series and compute the sum of the series at $x = 0$ and $x = \pi$.
So I managed to compute the Fourier series so that
$$u(x) = \frac{1}{2} + \sum_{-\infty,\space n \space \mathrm{odd}}^{\infty} \frac{e^{inx}}{in\pi}.$$
But now I am wondering, first of all, the sum at $x = 0$ should, according to the book, be $\frac{1}{2},$ but in the beginning it is stated that $u(0) = 1$. Is that just the Fourier representation doing a "bad job"?
Secondly, I keep failing when I am trying to compute the sum. Beginning with $x=0$, I tried to compute
$$u(0) = \frac{1}{2} + \frac{1}{i\pi} \sum_{-\infty}^{\infty} \frac{1}{2n-1}.$$ I wrote it like that because $n$ is odd. But doesn't $\sum_{-\infty}^{\infty} \frac{1}{2n-1}$ diverge?
Concerning the "bad job", please refer to the Dirichlet Fourier Series Conditions (Dirichlet's Theorem). As Bungo mentioned, to address the issue of the divergence of $\sum {1\over 2n-1}$, it is best to write the series as a limit: $$u(x)=\lim_{N\rightarrow \infty}u_N(x)$$ where $$u_N(x)=\frac 12 +\frac1{i\pi}\sum_{-N,\ n \text{ odd}}^N\frac {e^{inx}}{n}$$ $$u_N(0)=\frac 12+\frac 1 {i\pi} \sum_{-N, \ n \text{ odd}}^N \frac 1n$$
$$u_N(0)=\frac 12+\frac 1 {i\pi} \left(\sum_{0}^N \frac 1{2n+1}-\sum_{0}^N \frac 1{2n+1}\right)$$ $$u_N(0)=\frac 12$$ $$u(0)=\lim_{N\rightarrow \infty}u_N(0)=\frac12$$