Evaluating $\int_{0}^{1} \lim_{n \rightarrow \infty} \sum_{k=1}^{4n-2}(-1)^\frac{k^2+k+2}{2} x^{2k-1} dx$ for $n \in \mathbb{N}$ For $n \in \mathbb{N}$, evaluate
$$\int_{0}^{1} \lim_{n \rightarrow \infty} \sum_{k=1}^{4n-2}(-1)^\frac{k^2+k+2}{2} x^{2k-1} dx$$
I could not use wolframalpha, I do not know the reason.
For $n = 1$, the integrand $=x+x^3$
For $n = 2$, the integrand $=x+x^3-x^5-x^7+x^9+x^{11}$
For $n = 3$, the integrand $=x+x^3-x^5-x^7+x^9+x^{11}-x^{13}-x^{15}+x^{17}+x^{19}$
and so on.
For $n = 1000$, the integrand $=x+x^3-x^5-x^7+x^9+x^{11}-x^{13}-x^{15}+x^{17}+x^{19}-\dots+x^{7993}+x^{7995}$
Using MS-EXCEL with $n=1000$, I found that the value is approximately $0.56...$.
I do not know if  $n \rightarrow \infty$ , will the required expression have a closed form or no.

Your help would be appreciated. THANKS!
 A: We seek to calculate $$\begin{align}\int_{0}^{1} \lim_{n \rightarrow \infty} \sum_{k=1}^{4n-2}(-1)^\frac{k^2+k+2}{2} x^{2k-1} dx&= \frac{1}{2}+\frac{1}{4}-\frac{1}{6}-\frac{1}{8}+\frac{1}{10}+\frac{1}{12}-\frac{1}{14}-\frac{1}{16}+\cdots \\&=\frac{1}{2}\left(\left(\frac{1}{1}-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+\cdots\right)+\left(\frac{1}{2}-\frac{1}{4}+\frac{1}{6}-\frac{1}{8}+\cdots\right)\right)\end{align}$$ Now $$\arctan{x}=x-\frac{x^3}{3}+\frac{x^5}{5}-\frac{x^7}{7}+\cdots \implies \frac{1}{1}-\frac{1}{3}+\frac{1}{5}-\frac{1}{7}+\cdots=\arctan{1}=\frac{\pi}{4}$$ and $$\ln(1+x)=x-\frac{x^2}{2}+\frac{x^3}{3}-\frac{x^4}{4}+\cdots \implies \frac{1}{2}-\frac{1}{4}+\frac{1}{6}-\frac{1}{8}+\cdots=\frac{1}{2}\left(\frac{1}{1}-\frac{1}{2}+\frac{1}{3}-\frac{1}{4}+\cdots\right)=\frac{\ln2}{2}$$ Hence our answer is $\frac{\pi}{8}+\frac{\ln2}{4}$.
A: Let
$$a = \int_{0}^{1} \lim_{n \rightarrow \infty} \sum_{k=1}^{4n-2}(-1)^\frac{k^2+k+2}{2} x^{2k-1} dx$$
Modified solution (now the main solution)
We have two choices: integral first then sum or vice versa.
Taking the integral first gives the following for the (finite) sum which we split immediately into even and odd terms
$$a=\sum_{k=1}^{4n-2}(-1)^\frac{k^2+k+2}{2} \frac{1}{2k}=\sum_{m=1}^{2n-1}(-1)^\frac{1+m}{2} \frac{1}{4m}+\sum_{m=1}^{2n-1}(-1)^\frac{1-m}{2} \frac{1}{4m-2}\tag{1}$$
Now we take the limit $n\to \infty$ to get the result $(4)$ of the original solution.
Claude Leibovici, in a comment, has taken the other altervative with the sum first.
Original solution
Exchanging integral and sum, and doing the limit in the sum gives
$$\sum_{k=1}^{\infty}(-1)^\frac{k^2+k+2}{2} \frac{1}{2k}$$
Now splitting even and odd summands
$k \to 2m$, $(-1)^{\frac{k^2+k+2}{2}}\to (-1)^{1+m+2m^2}\to (-1)^{1+m}$
$$s_{e} = \sum_{m=1}^{\infty} (-1)^{1+m} \frac{1}{4 m}=\frac{\log(2)}{4}\tag{2}$$
$k \to 2m-1$, $(-1)^{\frac{k^2+k+2}{2}}\to (-1)^{1-m+2m^2}\to (-1)^{1-m}$
$$s_{o} = \sum_{m=1}^{\infty} (-1)^{1+m} \frac{1}{4 m-2}=\frac{\pi}{8}\tag{3}$$
Hence we have
$$a = s_{e}+s_{o} = \frac{\log(2)}{4} +\frac{\pi}{8}\simeq 0.565986... \tag{4}$$
A: Hint:  Notice that the sum is of consecutive odd powers of $x$ changing sign every two terms.  What if you break it up into two sums, one of which is of the powers $4k+1$ and one of which is the powers of $4k+3$, both of alternating sign, and compare them to the Taylor series for $\frac{1}{1+y}$ for some suitable $y$.
