Question about calculating $\sum_{n=0}^{\infty}\frac{(-1)^n}{3n+1}$ Evaulate:
$$\sum_{n=0}^{\infty}\frac{(-1)^n}{3n+1}$$
Answer:
To evaluate $\sum_{n=0}^{\infty}\frac{(-1)^n}{3n+1}$ we use maclaurin series of $f(x)=\frac1{1+x^3}$:
$$\frac1{1+x^3}=\sum_{n=0}^{\infty}(-1)^nx^{3n}$$
and after taking  $\int_{0}^{1}$ of both sides, the series will be equal to $\sum_{n=0}^{\infty}\frac{(-1)^n}{3n+1}$  which we were looking for and left hand side is:
$$\int_{0}^{1}\frac{1}{x^3+1}dx=[\frac13\ln(1+x)-\frac16\ln(x^2-x+1)+\frac{\sqrt3}{3}tan^{-1}\left(\frac{2x-1}{\sqrt3}\right)]\big|_0^1$$
$$=\frac13\ln2+\frac{\sqrt3\pi}{9} $$
My question:
In the answer above we evaluated $\int_{0}^{1}\frac1{x^3+1}dx$ because $\int_{0}^{1}[\sum_{n=0}^{\infty}(-1)^nx^{3n}]dx=\sum_{n=0}^{\infty}\frac{(-1)^n}{3n+1}$.
But if we consider:
$$g(x)=\sum_{n=0}^{\infty}(-1)^nx^{3n}$$
$$G(x)=\int\sum_{n=0}^{\infty}(-1)^nx^{3n}dx$$
Then  $$G(1)=\sum_{n=0}^{\infty}\frac{(-1)^n}{3n+1}$$
And we can see $G(1)$ is also equal to series we are trying to calculate. Hence for $f(x)=\frac1{1+x^3}$ because $f(x)=g(x)$, If we consider $F(x)$ as antiderivative of $f(x)$. Then $\sum_{n=0}^{\infty}\frac{(-1)^n}{3n+1}=G(1)=F(1)=\frac13\ln2+\frac{\sqrt3\pi}{\color{red}{18}}$. Which is different from what we get in the answer. So what is the problem of this method?
 A: The short answer is that the antiderivative you selected doesn't vanish at zero, whereas $\sum_{n=0}^\infty (-1)^n \frac{x^{3n+1}}{3n+1}$ does. So when you evaluated the antiderivative at the endpoints in the first computation, you picked up a contribution at zero that you have lost in your second computation.
To do the second computation correctly, you would need to include a "$+C$" in your antiderivative and then match it with the series by plugging in a value of $x$ where you know the value of the series. The obvious choice for this value of $x$ is $0$. But now effectively you have selected the antiderivative to be $\int_0^x g(y) dy$ in the first place, so why go through these extra steps rather than just evaluating $\int_0^1 g(y) dy$ immediately?
In general, various identities involving integrals in analysis do not hold in their simple form when you start talking about indefinite integrals. Accordingly, I usually suggest using definite integrals (possibly with variable limits) whenever it is at all convenient to do so.
