integration of $\int \frac{1}{x+ i\:y}\mathrm{d} x$ I can't seem to find where this result comes from
$$
\int \frac{1}{x+  i\:y}\mathrm{d} x = \frac{\ln(x^2
+y^2)}{2} - i \: \arctan \left( \frac{x}{y} \right)
$$
by my calculation the result should be
$$
\int \frac{1}{x+  i\:y}\mathrm{d} x = \frac{\ln(x^2
+y^2)}{2} + i \: \arctan \left( \frac{y}{x} \right)
$$
as
$$
\frac{\mathrm{d} }{\mathrm{d} x} \ln (x+a) = \frac{1}{x+a}  \Rightarrow \int \frac{1}{x+  a}\mathrm{d} x = \ln (x+a) 
\\
\ln (x+a)  = \ln (|x+a| e^{i \arg{(x+a)}}) = \ln \left( \sqrt{x^2+y^2} \right) + i \underbrace{\arg{(x+a)}}_{\arctan \left( \frac{y}{x} \right)}
$$
 A: There are different ways to express the same function, and if you compute an unspecified primitive (antiderivative) of some function, the integration constants further enlarge the number of possibilities to express the same family of functions in different ways.
Here, the relations
$$\arctan \frac{1}{\phi} = \int_0^{\frac{1}{\phi}}\frac{dt}{1+t^2} = \int_{\infty}^\phi \frac{1}{1+u^{-2}}\biggl(-\frac{1}{u^2}\biggr)\,du = \int_\phi^\infty \frac{du}{1+u^2} = \frac{\pi}{2}-\arctan\phi$$
for $\phi > 0$ and $\arctan\frac{1}{\psi} = -\arctan\frac{1}{\lvert\psi\rvert} = -\bigl(\frac{\pi}{2}-\arctan \lvert\psi\rvert\bigr) =-\frac{\pi}{2} - \arctan\psi$ for $\psi < 0$ show that the two functions $\arctan\frac{y}{x}$ and $-\arctan\frac{x}{y}$ only differ by a constant on each connected component of their common domain, hence both results are correct(1).
(1) Logically, there is also the possibility that both are incorrect when the two differ only by a locally constant function, but in this case, the results are correct.
