= Solution
Use the real <Fourier series> convention $f(x)\sim a_0/2+\sum_{n\geq1}[a_n\cos(n\pi x)+b_n\sin(n\pi x)]$ for period two. The <Fourier coefficients> are
$$
a_0=\int_0^1 2x\,dx=1,\quad a_n=\int_0^1 2x\cos(n\pi x)\,dx=\frac{2[(-1)^n-1]}{n^2\pi^2},\quad b_n=\int_0^1 2x\sin(n\pi x)\,dx=\frac{2(-1)^{n+1}}{n\pi}.
$$
The last two <integrals> follow by <integration by parts>. Thus the <Fourier series of a half-wave rectified ramp> is
$$
f(x)\sim\frac12-\frac4{\pi^2}\sum_{r=0}^\infty\frac{\cos((2r+1)\pi x)}{(2r+1)^2}+\frac2\pi\sum_{n=1}^\infty\frac{(-1)^{n+1}}n\sin(n\pi x).
$$
On $(-1,1)$, $f(x)=|x|+x$. Its <even> part is $f_e(x)=|x|$ and its <odd> part is $f_o(x)=x$, so the cosine and sine terms separate:
$$
\boxed{f_e(x)=\frac12-\frac4{\pi^2}\sum_{r=0}^\infty\frac{\cos((2r+1)\pi x)}{(2r+1)^2},\qquad f_o(x)=\frac2\pi\sum_{n=1}^\infty\frac{(-1)^{n+1}}n\sin(n\pi x).}
$$
At a jump, the <Fourier series> converges to the average of the one-sided limits. Thus the first series for $f$ takes the value $1$ at odd integers, while the <Fourier series of a periodic sawtooth> for $f_o$ takes the value $0$ there. The even function has a continuous periodic extension.
At $x=0$, the formula for $f_e$ gives $0=1/2-(4/\pi^2)\sum_{r\geq0}(2r+1)^{-2}$. At $x=1/2$, the formula for $f_o$ has only odd-index terms and gives $1/2=(2/\pi)\sum_{r\geq0}(-1)^r/(2r+1)$. Hence
$$
\boxed{\sum_{r=0}^\infty\frac1{(2r+1)^2}=\frac{\pi^2}{8},\qquad\sum_{r=0}^\infty\frac{(-1)^r}{2r+1}=\frac\pi4.}
$$
Back to article page