Find the fourier series for $f(x)=\cases{x-[x]\quad x\in\mathbb{R\setminus Z} \\ \frac 1 2\quad x\in\mathbb{Z}}$ on $[-\pi,\pi]$ and its values for $x=1.5,3,5$.
In order to find the series I need to find fourier coefficients but that's not clear to me how to inetegrate $\int_{-\pi}^\pi f(x)\cos(nx)dx$. I thought dividing it to $$\int_{x\in\mathbb Z} \frac 1 2dx+\underbrace{\int_{z\notin\mathbb Z}(x-[x])\cos(nx)dx}_{=2\pi\int_0^1(x-[x])\cos(nx)dx}$$but then I can't deal with the last integral (first is integration on set of measure zero so it equals 0). Furthermomre, suppose I found the series, since this function is continuous at almost every point can I say that substituting the x values is sufficient (i.e the series is uniformally convergent to the function on the interval)?
One have to cut the integrals in a sum of segments where the floor function is constant on each :
The result has been checked with several numerical tests.
Other examples corresponding to the particular values requested in the wording of the question :
There is a typing mistake in the table above. Please, replace $4$ by $5$. Sorry, I didn't succeed to correct it because I cannot replace the page by a corrected page (bug each time).