Arctan in complex logarithm form I tried to formulate the arctan function in a complex logarithmic form by integrating its derivative by using partial fraction decomposition. And I was wondering if my attempt is valid or not:
Using $\frac{d}{dz}\arctan(z) = \frac{1}{1+z^2}$ one knows that
$\int \frac{1}{1+z^2} dz =\arctan(z)$
Using partial fraction decomposition one gets 
$ \frac{1}{1+z^2} = \frac{1}{(z-i)(z+i)} = \frac{1}{2i}\frac{1}{(z-i)} - \frac{1}{2i}\frac{1}{(z-i)}$.
Then one can integrate:
$\int \frac{1}{1+z^2} dz = \frac{1}{2i} \int \frac{dz}{(z-i)} - \frac{1}{2i} \int \frac{dz}{(z+i)} = \frac{\log(z-i) -\log(z+i)}{2i}$
So my result would be $\arctan(z) = \frac{\log(z-i) -\log(z+i)}{2i}$. Is this correct?
Any comment or advice would be highly appreciated!
 A: $$\text{arctanh}(iz)=\sum_{i=0}\frac{(iz)^{2k+1}}{(2k+1)!}$$
but $$i^{2k+1}=i^{2k}i=\begin{cases}-i&\text{if }k\text{ is odd}\\i&\text{if }k\text{ is even},\\\end{cases}$$
then,
$$\sum_{i=0}^\infty \frac{(iz)^{2k+1}}{(2k+1)!}=i\sum_{i=0}^\infty \frac{(-1)^kz^{2k+1}}{(2k+1)!}=i\arctan(z)$$
and thus 
$$\arctan(z)=\frac{\text{arctanh}(iz)}{i}.$$
But $\text{arctanh}(z)=\frac{1}{2}\ln\left(\frac{1+z}{1-z}\right)$ and so, we conclude that,
$$\arctan(z)=\frac{1}{2i}\ln\left(\frac{1+iz}{1-iz}\right)=\frac{\ln(1+iz)-\ln(1-iz)}{2i}.$$
A: As @gammatester mentioned, you forgot an integration constant.  But what value should this integration constant be?  We do know that we want $\arctan{(0)} = 0$.  Then we would have
$$\frac{\log{(-i)} - \log{(i)}}{2 i} + C = 0$$
What is $\log{(-i)}$?  Is $-i = e^{-i \pi/2}$, or $e^{i 3 \pi/2}$, or something else?  Regardless, the question is, is the difference between the logs then $i \pi$ or $-i \pi$?  
Here we note that the principal value of the arctan is defined with respect to a branch cut $-i z \in (-\infty,-1] \cup [1,\infty) $.  Thus, we would take $-i = e^{-i \pi/2}$ and the difference between the logs to be $-i \pi$; thus, $C=\pi/2$. Thus
$$\arctan{z} = \frac1{2 i} \left [\log{(z-i)} - \log{(z+i)} - i \pi \right ]  = \frac{i}{2} \log{\left ( \frac{i+z}{i-z}\right )}$$
A: @gammatester: Yes, you are right! I missed that one! So using 
(1)
$e^{i\frac{\pi}{2}} = \cos(\frac{\pi}{2}) + i\sin(\frac{\pi}{2}) = i$
in my formula
$\frac{\log(z-i) - \log(z+i)}{2i} + C ~~~~~~~~~$ for $z=0$
I get $C=\frac{\pi}{2}$.
Then using (1) again I can rewrite this as
$\frac{\log(z-i) - \log(z+i)}{2i} - i \cdot \log(i) =\frac{\log(z-i) +\log(i) - (\log(z+i)-\log(i))}{2i}$
By applying logarithm laws I then get the same result as @idm !
$\frac{\log(z-i) +\log(i) - (\log(z+i)-\log(i))}{2i} = \frac{\log(1+iz) - \log(1-iz)}{2i} = \arctan(z)$ 
Many Thanks to both of you! :)
