Fourier series $\sum_{k=0}^\infty \frac{(-1)^k}{(2k+1)^2} \cos \left(\pi \left(k+\frac{1}{2} \right)x \right)$ for $x \in (-1,1)$ What is the closed form for this Fourier series:
$$f_2(x)=\sum_{k=0}^\infty \frac{(-1)^k}{(2k+1)^2} \cos \left(\pi \left(k+\frac{1}{2} \right)x \right)$$
For $x \in (-1,1)$.
The reason I'm asking is this. For $x \in (-1,1)$ we have:
$$f_1(x)=\sum_{k=0}^\infty \frac{(-1)^k}{(2k+1)} \cos \left(\pi \left(k+\frac{1}{2} \right)x \right)=const=\frac{\pi}{4}$$
$$f_3(x)=\sum_{k=0}^\infty \frac{(-1)^k}{(2k+1)^3} \cos \left(\pi \left(k+\frac{1}{2} \right)x \right)=c (1-x^2)=\frac{\pi^3}{32} (1-x^2)$$
So we have a square wave for $f_1$ and parabolic wave for $f_3$. By the same logic I expected to have a linear (sawtooth) wave for $f_2$, but Wolfram Alpha gives a very smooth plot:

This looks a lot like half a circle, but it's not $c \sqrt{1-x^2}$.
For $x=0$ we have:
$$f_2(0)=G$$
Where G is the Catalan constant.
 A: $f_1(x)$ is a "square wave" function and $f_3(x)$ is a "parabolic wave" function.
But we cannot expect that $f_2(x)$ be "sawtooth wave" function because it is a different series with $\sin$ instead of $\cos$.
The idea behind to find a "sawtooth wave" or a "triangle wave" as an intermediate between "square wave" and "parabolic wave" is interesting. But this cannot be done only with the change of power of $(2k+1)$. In fact, this is the degree of derivation, or integration which provides the expected result.
If you want to obtain a "triangle wave", either integrate $f_1(x)$ or differentiate $f_3(x)$ : Of course the power of $(2k+1)$ changes as suggested, but also the $\cos$ changes to $\sin$ and the expected result is obtained.
It is easy to express $f_2(x)$ in terms of Lerch function as already pointed out.
One cannot expect a simpler answer with the integral form (below) :

A: I am not sure that this is what you are looking for:
We have
$$
\frac{1}{1+x^2}=\sum_{k=0}^\infty(-1)^kx^{2k}
$$
and
$$
\tan^{-1}x=\int_0^x\frac{dt}{1+t^2}=\sum_{k=0}^\infty \frac{(-1)^k}{2k+1}x^{2k+1}
$$
and thus
$$
\frac{\tan^{-1}x}{x}=\sum_{k=0}^\infty \frac{(-1)^k}{2k+1}x^{2k}
$$
and finally
$$
\int_0^x\frac{\tan^{-1}t\,dt}{t}=\sum_{k=0}^\infty \frac{(-1)^k}{(2k+1)^2}x^{2k+1}
$$
This holds, in the place of $x$, for every complex number $z$, with $|z|\le 1$.
Set $w=\exp(i\pi x/2)$, then
$$
\sum_{k=0}^\infty \frac{(-1)^k\sin\big(\pi(2k+1)x/2\big)}{(2k+1)^2}=\mathrm{Im}\int_0^w\frac{\tan^{-1}z\,dz}{z}=\mathrm{Im}\int_0^1\frac{\tan^{-1}(rw)\,w\,dr}{rw}\\ =\mathrm{Im}
\int_0^1\frac{\tan^{-1}(rw)\,dr}{r}.
$$
Note that
$$
\int_0^w\frac{\tan^{-1}z\,dz}{z}=\mathrm{T}i_2(w)
=\frac{1}{2i}\big(\mathrm{L}i_2(iw)-\mathrm{L}i_2(-iw)\big),
$$
where $\mathrm{L}i_2(z)=z\Phi(z,2,1)$, and
$$
\Phi(z,2,1)=\sum_{n=0}^\infty\frac{z^n}{(n+1)^2}.
$$
A: $$\newcommand{\Li}{\operatorname{Li}}
\begin{align}
&\sum_{k=0}^\infty\frac{(-1)^k}{(2k+1)^2}\cos\left(\pi\left(k+\frac12 \right)x\right)\\
&=\mathrm{Re}\left[\sum_{k=0}^\infty\frac{(-1)^k}{(2k+1)^2}e^{i\pi (2k+1)x/2}\right]\\[6pt]
&=\mathrm{Re}\left[\frac1{2i}\left(\Li_2\!\left(ie^{i\pi x/2}\right)-\Li_2\!\left(-ie^{i\pi x/2}\right)\right)\right]\\[12pt]
&=\mathrm{Im}\left[\frac12\left(\Li_2\!\left(e^{i\pi(x+1)/2}\right)-\Li_2\!\left(e^{i\pi(x-1)/2}\right)\right)\right]\\[6pt]
&=\bbox[5px,border:2px solid #C0A000]{\frac{\Li_2\!\left(e^{i\pi (x+1)/2}\right)-\Li_2\!\left(e^{-i\pi(x+1)/2}\right)-\Li_2\!\left(e^{i\pi(x-1)/2}\right)+\Li_2\!\left(e^{-i\pi(x-1)/2}\right)}{4i}}
\end{align}
$$
where $\Li_2$ is the Polylogarithm of order $2$.
A: Wolfram Mathematica gives an answer in terms of Lerch transcendent functions (LerchPhi in Mathematica):
$$\frac18 e^{-\frac12i\pi x}\Phi\left(-e^{-i\pi x},2,\frac12\right)+\frac18 e^{\frac12i\pi x}\Phi\left(-e^{i\pi x},2,\frac12\right).$$
