Q:

Differentiation Chain Rule for Quaternion Functions of Quaternions

I am trying to calculate the time derivative of a quaternion function:
$$\mathbf{p}\left(t\right)=\left(\mathbf{q}\left(t\right)\right)^{\tau}$$
Where I've used bold font to indicate that $\mathbf{p}$ and $\mathbf{q}$ are each quaternions, while $\tau$ is just a scalar (not limited to integers). What I would like to be able to do is apply some sort of effective chain rule for quaternionic differentiation to calculate the time derivative:
$$\dot{\mathbf{p}}=\frac{\partial\mathbf{p}}{\partial\mathbf{q}}\cdot\dot{\mathbf{q}}$$
Where the dot operator ($\cdot$) represents the usual quaternion multiplication. With some effort, I believe that I have shown that $\mathbf{p}$ is quaternionic holomorphic and that its quaternionic derivative with respect to $\mathbf{q}$ is exactly what you'd expect:
$$\frac{\partial\mathbf{p}}{\partial\mathbf{q}} = \tau\mathbf{q}^{-1}\cdot\mathbf{p} = \tau\mathbf{p}\cdot\mathbf{q}^{-1}=\tau\mathbf{q}^{\tau-1}$$
Unfortunately, when I try different functions for $\mathbf{q}\left(t\right)$ and the above chain rule, I don't get the actual rate of change of the function $\mathbf{p}\left(t\right)$, which I am estimating numerically. I understand that, if I really want to, I should be able to calculate the full time derivative of $\mathbf{p}$ without using the chain rule. But life would be a lot easier for me if I didn't have to resort to that in all cases.
Is there a quaternionic version of the chain rule that I can use to simplify some of my research? Please help!
If you're interested, here's a link to a PDF where I verify the quaternionic holomorphicity of $\mathbf{p}$: https://www.scribd.com/document/352235082/Quaternionic-Holomorphicity-Verification

A:

First, even for complex numbers, the function $q^\tau$ has complications in even being defined when $\tau$ is not an integer (you have to use branch cuts in the plane, which forces $q^\tau$ to be discontinuous as almost all points on the branch). For example, $q^{1/2}$ with respect to the standard choice of branch cut (the negative real axis) is discontinuous at negative one: as $q\to-1$ from the upper half plane, we get $q^{1/2}\to i$, whereas as $q\to -1$ from the lower half plane, we get $q^{1/2}\to -i$. The situation becomes even worse if you're letting $\tau$ be nonreal. None of these complications go away when we work with quaternions.
Second, even if $\tau$ is an integer, no $q^\tau$ is not generally left or right holomorphic as a function of the quaternion variable $q$. I am not going to bother reading  the cumbersome derivation in the scribd page because this is a well-established fact. It will be a smooth map between real manifolds if you forget the quaternion multiplication operation though, so it's possible you're confusing holomorphic with  that weaker condition.
Here's an example: consider $f(q)=q^2$. Write out the right derivative as follows:
$$ \begin{array} \big[f(q+h)-f(q)\big]h^{-1} & =\big[(q+h)^2-q^2\big]h^{-1} \\ & = [hq+qh+h^2]h^{-1} \\ & = hqh^{-1}+q+h \end{array} $$
Note that $hqh^{-1}$ does not depend on the magnitude of $h$, only on its phase and the direction of its imaginary part (its vector component). Indeed, if $h=\varepsilon e^{\theta u}$ is its polar form, $hqh^{-1}$ will be the result of rotating $q$'s vector component around the vector $u$ by an angle of $2\theta$. As such, the limit of $hqh^{-1}$ as $h\to0$ will depend on which direction $h\to0$ in, and  thus the limit does not exist.
In fact, it is known the only left and right holomorphic quaternion functions (with domain all of $\mathbb{H}$) are the affine functions $qa+b$ and $aq+b$ respectively.
Third, even if $\tau$ is a whole number, the time derivative of $q(t)^\tau$ is still not what you say it is, essentially because $q(t)$ and $q'(t)$ generally have no reason to commute. However, even in a noncommutative setting we still have the product rule (exercise: prove the product rule without assuming $f(t_1)$ ever commutes with $g(t_2)$ for any $t_1$ or $t_2$), which can be used to give
$$ \begin{array}{ll} \displaystyle \frac{dq^2}{dt} & \displaystyle =\frac{dq}{dt}q+q\frac{dq}{dt} \\ \displaystyle \frac{dq^3}{dt} & \displaystyle = \frac{dq}{dt}q^2+q\frac{dq}{dt}q+q^2\frac{dq}{dt} \\ \displaystyle \frac{dq^4}{dt} & \displaystyle = \frac{dq}{dt}q^3+q\frac{dq}{dt}q^2+q^2\frac{dq}{dt}q+q^3\frac{dq}{dt} \end{array} $$
and so on. Thus,
$$ \frac{dq^n}{dt}=\sum_{k=0}^{n-1} q^k \frac{dq}{dt} q^{n-k-1} $$
by induction. We may obtain time derivatives of negative powers indirectly:
$$ 0 = \frac{d}{dt}(1)=\frac{d}{dt} (q^nq^{-n})=\frac{dq^n}{dt}q^{-n}+q^n\frac{dq^{-n}}{dt} $$
$$ \implies \frac{dq^{-n}}{dt}=-q^{-n}\frac{dq^n}{dt}q^{-n}. $$

