Find $i\log(x-i)+i^2\pi+i^3\log(x+i)+i^4(2\arctan x)$, if $x>0$ 
Find $i\log(x-i)+i^2\pi+i^3\log(x+i)+i^4(2\arctan x)$, if $x>0$

The equation can be written as $$y=i\log(x-i)-\pi-i\log(x+i)+2\arctan x$$
$$y=i\log\frac{x-i}{x+i}-\pi+2\arctan x$$
Let $x+i=re^{i\theta}$ so
$x-i=re^{-i\theta}$.
$$y=i\log(e^{-2i\theta})-\pi+2\arctan x$$
$\theta=\arctan\frac{1}{x}=\cot^{-1}x$
$$y=2\cot^{-1}x-\pi+2\tan^{-1}x=2\cdot\frac{\pi}{2}-\pi=0$$
Is this correct?
 A: The last step is wrong.
Please note the following:
If $x+i=re^{i\theta}$, then $\theta=$ arg (x+i) = $\arctan \frac{1}{x}=arccot x$ 
So,

$$i\log(e^{-2i\theta})-\pi+2\arctan x$$
  $$=i(\log|1|+(-2i\theta))-2(\frac{\pi}{2}-\arctan x)$$
  $$=i(\log|1|-2i\theta)-2arccot x$$ $$=2arccot x-2arccot x$$ $$=0$$

Hope this helps.
A: Assume $x\in\mathbb{R^+}$:
$$y(x)=i\ln(x-i)+i^2\pi+i^3\ln(x+i)+i^4\left(2\arctan(x)\right)=$$
$$i\ln(x-i)-\pi-i\ln(x+i)+1\left(2\arctan(x)\right)=$$
$$i\ln(x-i)-\pi-i\ln(x+i)+2\arctan(x)=$$
$$2\arctan(x)-\pi+i\left(\ln(x-i)-\ln(x+i)\right)=$$
$$2\arctan(x)-\pi+i\left(\ln\left(\frac{x-i}{x+i}\right)\right)=$$
$$2\arctan(x)-\pi+i\left(-2i\text{arccot}(x)\right)=$$
$$2\arctan(x)-\pi+2\text{arccot}(x)=$$
$$2\left(\arctan(x)+\text{arccot}(x)\right)-\pi=$$
$$2\left(\arctan(x)+\arctan\left(\frac{1}{x}\right)\right)-\pi=2\left(\frac{\pi}{2}\right)-\pi=\pi-\pi=0$$
So:
$$y(x)=2\left(\arctan(x)+\text{arccot}(x)\right)-\pi=0\space\space\space\space\space\space\space\space\space\space\text{with}\space\space x\in\mathbb{R^+}$$
