I'm doing some kind of research, and the multidimensional version of what I'm doing involves taking the $\arctan$ function of a strictly real square matrix. The matrix is not guaranteed to be invertible, and if the $\arctan$ is complex the matter becomes much more complicated. I checked Wikipedia but could not find any necessary and sufficient conditions. So, I'm asking here.
The matrix I'm trying to apply $\arctan$ to is one with arbitrary elements, and it would be good if the $\arctan$ I'm looking for is continuous w.r.t. the parameters (at least when they're real), so I'm asking it here too - is there a branch of $\arctan$, of a square matrix whose elements are in the reals, that is continuous w.r.t. the elements (or differentiable/smooth etc if any)?
P.S. I've done some calculations by myself- from Sylvester's formula, it seems that a strictly real square matrix has a strictly real arctan if (but not necessarily only if) none of its eigenvalues are $i$ or $-i$. A real matrix always has conjugate eigenvalues, so what I'm wondering here is actually just this- even if the given matrix has $\pm i$ as eigenvalues, the infinity of arctan at eigenvalue +i and the infinity of arctan at eigenvalue $-i$ could maybe cancel out, leaving only a real, finite number behind.
EDIT: I have found out a way to circumvent it during research, but thank you for the answers!
a priori, we can define $\arctan(z)$ for every $z\in U=\mathbb{C}\setminus\{-i,i\}$; roughly speaking, it suffices to put $\arctan(z)=\dfrac{1}{2i}\log(\dfrac{z-i}{z+i})+constant$. Yet, we must work on one or several determinations of the $\log$ function. Note also that $U$ is not simply connected.
If we do not impose continuity to $\arctan$, then we can do like Maple: but the obtained function is not continuous (for example) on $\{ib;b>1\}$. Otherwise, we have to restrict the definition domain to a simply connected set; for example
$V=\mathbb{C}\setminus\{ib;|b|\geq 1\}$.
Then we can define an holomorphic function $\arctan$ on $V$ (with unicity if we put $\arctan(1)=\pi/4$).
The extension to the $n\times n$ complex matrices with spectrum included in $V$ is standard (use complex Jordan form); moreover, the $\arctan$ of a real matrix is real (use real Jordan form).