Trigonometric functions of quaternions Are trigonometric functions defined for quaternions? I already know that the exponential function is defined for them, so for example as $$\cos\left(x\right)=\frac{e^{ix}+e^{-ix}}{2}$$ could this definition be extended to quaternions, and if so is this the simplest way of calculating it?
 A: Background: for me, a quaternion is a sum $r+\mathbf{v}$ of a scalar $r$ and a vector $\mathbf{v}$, which may be called the real and imaginary parts. The square roots of $-1$ are precisely the unit vectors $\mathbf{u}$, and all quaternions have a polar form $q=r\exp(\theta\mathbf{u})$ where $r=|q|$ is the magnitude (defined by $|q|^2=r^2+\|\mathbf{v}\|^2$) and $\mathbf{u}=\mathbf{v}/\|\mathbf{v}\|$ is the normalized imaginary part and $\theta$ is a convex angle (i.e. in $[0,\pi]$). This form is unique if $q\ne 0,\pm1$.
You can define $\cos$ and $\sin$ and $\tan$ in many inequivalent ways. For instance, for $\cos$, you could use the formula you gave (as the symmetrization of $e^{iq}$), but then $e^{\mathbf{i}q}$ and $e^{q\mathbf{i}}$ are different! For $\sin$, it matters if you put the denominator $(2\mathbf{i})^{-1}$ on the left or right side. And similarly for $\tan$, it matters if you do the noncommutative division as $(\sin q)(\cos q)^{-1}$ or $(\cos q)^{-1}\sin q$. Not to mention, all of these will disagree with the Taylor series for $\sin,\cos,\tan$ evaluated at quaternion arguments.
Personally, I think the most "natural" way to go is to start at the hyperbolic trig functions, e.g.
$$ \cosh(q)=\frac{e^q+e^{-q}}{2}, \quad \sinh(q)=\frac{e^q-e^{-q}}{2}. $$
In this case, $\cosh$ and $\sinh$ of quaternions match their usual Taylor series evaluated at quaternions, and they both commute (for any $q$) so $\tanh(q)$ is unambiguous. Then, we have formulas for $\sin,\cos,\tanh$ in terms of them (which, usually mean they have the same "graph" but "rotated" within $\mathbb{C}^2$) if you really want.
To evaluate e.g. $\cosh(q)$ for a quaternion $q$, it's not much different than for an arbitrary complex number; that is, if $\cosh(a+bi)=c+di$ then $\cosh(a+b\mathbf{u})=c+d\mathbf{u}$ for any unit vector $\mathbf{u}$.
To evaluate $e^q$, write it as $e^{r+\mathbf{v}}=e^re^{\mathbf{v}}$ (since scalars $r$ are central, they commute with everything, so this is valid), which by Euler's formula must equal
$$ e^q = e^r\left[\cos(\|\mathbf{v}\|)+ \sin(\|\mathbf{v}\|) \frac{\mathbf{v}}{\|\mathbf{v}\|}\right] $$
Then you can use this to finish evaluating $\cosh(q)$.
