Series expansion for $\arctan(1-x)$ Series expansion for $\arctan(1-x)$
I try to expand this function into its Taylor series by means of differentiating it and then integrating it terms by terms but I fail to obtain the correct result.
The derivative of $\arctan(1-x)=-\dfrac{1}{x^2-2x+2}$. By using long division, I can obtain the series expansion for $-\dfrac{1}{x^2-2x+2}$ and it is 
$-\dfrac{1}{2}-\dfrac{x}{2}-\dfrac{x^2}{4}+\dfrac{x^4}{8}+\dfrac{x^5}{8}+\dfrac{x^6}{16}...$
I integrate this series terms by terms and I obtain:
$0-\dfrac{x}{2}-\dfrac{x^2}{4}-\dfrac{x^3}{12}+\dfrac{x^5}{40}+\dfrac{x^6}{48}-\dfrac{x^7}{122}...$
The series according to Wolfram is: $\dfrac{\pi}{4}-\dfrac{x}{2}-\dfrac{x^2}{4}-\dfrac{x^3}{12}+\dfrac{x^5}{40}+\dfrac{x^6}{48}-\dfrac{x^7}{122}...$.
I notice that if I use the indefinite integral, there is going to be an arbitrary constant left after the integrating process. How do I obtain this $\dfrac{\pi}{4}$? Without it, is my series wrong?
Is there any other methods to expand this function into Maclaurin series without directly employing the Maclaurin formula
 A: When you integrate it, you get a $+C$. To get it's value, you can substitute in $x=0$ to get that $C=\arctan(1)$.
A: For $n\in\mathbb{N}$, the derivative of $\arctan z$ is
\begin{equation*}
(\arctan z)^{(n)}
=\frac{(n-1)!}{(2z)^{n-1}}\sum_{k=0}^{n-1}(-1)^k\binom{k}{n-k-1}\frac{(2z)^{2k}}{(1+z^2)^{k+1}}.
\end{equation*}
The function $\frac{\arctan z}{z}$ has Taylor's series expansion
\begin{equation}\label{arctan-pi-4-ser-eq}
\frac{\arctan z}{z}=\sum_{n=0}^{+\infty}(-1)^n\Bigl[\frac{\pi}{4}+T(n)\Bigr](z-1)^n,\quad |z-1|<\sqrt{2}\,,
\end{equation}
where
\begin{equation}\label{T(n)-dfn-notation}
T(n)=
\begin{cases}
0, & n=0;\\ \displaystyle
\sum_{k=1}^{n}\frac{(-1)^{k}}{2^{k/2}k}\sin\frac{3k\pi}{4}, & n\in\mathbb{N}.
\end{cases}
\end{equation}
Hence, we derive
\begin{equation}\label{arctan(1-z)-pi-4-ser-eq}
\frac{\arctan (1-z)}{1-z}=\sum_{n=0}^{\infty}\Bigl[\frac{\pi}{4}+T(n)\Bigr]z^n,\quad |z|<\sqrt{2}\,,
\end{equation}
which can be rearranged as
\begin{align}
\arctan (1-z)&=\sum_{n=0}^{\infty}\Bigl[\frac{\pi}{4}+T(n)\Bigr]z^n
-\sum_{n=0}^{\infty}\Bigl[\frac{\pi}{4}+T(n)\Bigr]z^{n+1}\\
&=\sum_{n=0}^{\infty}\Bigl[\frac{\pi}{4}+T(n)\Bigr]z^n
-\sum_{n=1}^{\infty}\Bigl[\frac{\pi}{4}+T(n-1)\Bigr]z^{n}\\
&=\frac{\pi}{2}+\sum_{n=1}^{\infty}[T(n)-T(n-1)]z^n\\
&=\frac{\pi}{2}+\sum_{n=1}^{\infty}\frac{(-1)^{n}}{2^{n/2}n}\sin\frac{3n\pi}{4}z^n\\
&=\frac{\pi}{2}-\frac{z}{2}-\frac{z^2}{4}-\frac{z^3}{12}+\frac{z^5}{40}+\frac{z^6}{48}+\frac{z^7}{112}-\frac{z^9}{288}-\dotsm.
\end{align}

*

*Feng Qi and Mark Daniel Ward, Closed-form formulas and properties of coefficients in Maclaurin's series expansion of Wilf's function, arXiv (2021), available online at https://arxiv.org/abs/2110.08576v1.

