<s>[INST] Summation problem: $f(x)=1+\sum_{n=1}^{\infty}\frac{x^n}{n}$ I want to evaluate this summation:

$$S=1+x+\frac{x^2}{2}+\frac{x^3}{3}+\frac{x^4}{4}+...+...$$
where, $|x|<1$

Here it is my approach
$$S=1+\sum_{n=1}^{\infty}\frac{x^n}{n}=f(x)$$
$$f'(x)=1+x+x^2+x^3+...+...=\frac{1}{1-x}$$
$$f(x)=\int f'(x)dx=\int \frac{1}{1-x} dx=-\ln(1-x)+C$$
$$f(0)=1 \Longrightarrow  C=1 $$
$$S=1-\ln(1-x)$$
And here is my problem:
I calculated this sum for only $|x|<1$.
Then, I checked in Wolfram Alpha and I saw that, this sum $f(x)$ converges for $x=-1$. But, this creating a contradiction with my solution. Because, the series $$f'(x)=1+x+x^2+x^3+...+...=\frac{1}{1-x}$$ for $x=-1$ doesn't converge, diverges. Therefore, there is a problem in my solution. But I can not find the source of the problem.

How can I prove the formula $f(x)=1-\ln(1-x)$ is also correct at the point $x=-1$ ?

Thank you very much.
 [/INST] It's well-known that $$\ln(1+y)=y-\frac{y^2}{2}+\frac{y^3}{3}-\frac{y^4}{4}+\cdots,~~~\forall y \in (-1,1].\tag1$$
Thus, let $y=-x.$ we have $$\ln(1-x)=-x-\frac{x^2}{2}-\frac{x^3}{3}-\frac{x^4}{4}+\cdots,~~~\forall x \in [-1,1).\tag2$$
As result, $$S=1+x+\frac{x^2}{2}+\frac{x^3}{3}+\frac{x^4}{4}+\cdots=1-\left(-x-\frac{x^2}{2}-\frac{x^3}{3}-\frac{x^4}{4}+\cdots\right)=1-\ln(1-x).$$
Notice that, $(1)$ demands $-1<y\leq 1$. then in $(2)$, we demand $-1<-x\leq 1,$ namely, $-1\leq x<1.$
</s>