Is trace of a slice of an elementary function of a matrix also elementary? Let we have an elementary function $f(W)$, applicable to a matrix.
Now consider the function
$g(x)=\operatorname{tr} f(W+x),$
where $x$ is scalar. Is $g(x)$ necessarily an elementary function?
Simple case: complex numbers (which as widely known can be represented as matrices).
$g(x)=\Re (f(z+x))$
where $x$ is real.
Is $g(x)$ elementary? What about split-complex numbers? What about more complicated cases?
 A: Here is a partial answer to your question that addresses the case of split-complex numbers and similar commutative number structures:
If $A$ is a finite-dimensional commutative associative unital $\mathbb{R}$-algebra, then it splits into local direct summands
$$
A \cong \bigoplus_{k=1}^N (A_k, \mathfrak{m}_k)
$$
where the local algebras $(A_k, \mathfrak{m}_k, \kappa_k)$ have residue fields $\kappa_k$ isomorphic to either $\mathbb{R}$ or $\mathbb{C}$. In particular, $A_k$ is a $\kappa_k$-algebra and you have $A_k \cong \kappa_k \oplus \mathfrak{m}_k$ as vector spaces.
So, if $f(x)$ is an analytic function, it suffices to consider local $\kappa$-algebras $(A,\mathfrak{m})$ with $\kappa$ being either the real or the complex numbers. Writing $Z = s \oplus X$ for $s$ a scalar in $\kappa$ and $X \in \mathfrak{m}$ (so in particular nilpotent) you get
$$
f(Z) = f(s) \oplus P
$$
where $P$ is a polynomial function. So, the answer to your question in this case is yes. Note that having one or another preferred basis for the algebra does not matter as it only amounts to a linear change of coordinates inside and outside of the function.
Regarding the non-commutative case, I had computed the operator calculus for 2x2 and 3x3 matrices by hand a while ago, and I am pretty sure that the answer is yes. I think there are references that do these computations, so I will try to dig them out. I believe the general case would also follow by using the Jordan Normal Form, but I haven't thought about it.
EDIT 1: Note that my answer does not address the case when $f(x)$ is real-analytic and you consider the real and imaginary component of its "complexification".
EDIT 2: The general finite-dimensional case does actually follow from the Jordan Normal Form: https://en.wikipedia.org/wiki/Analytic_function_of_a_matrix If $J$ is the Jordan Normal Form of $W$, which is a fixed matrix in your question, then $W+x$ has the Jordan Normal Form $J+x$, because $x$ is a scalar. Indeed, if $J = P^{-1} W P$, then $P^{-1} (W+x) P = J+x$ is again Jordan Normal Form, so taking the trace results in an elementary functions of $x$ (shifted by the eigenvalues of $W$).
