Any motion of a rigid object is equivalent to a rotation around some axis followed by a translation along that axis. We can therefore represent any motion mathematically using some object that includes information for a single rotation and a single translation. An extremely convenient object for this purpose is the dual quaternion. Part of their convenience is that the translational and angular velocities that describe the rates of change of the motion can also be expressed as dual quaternions, so the whole process of modeling a moving object can be done in a single mathematical framework. But since we are talking about rates of change, in order to make this work we need to extend some concepts from real-number calculus to the world of dual quaternions. First, however, some foundational material.
Quaternions
A rotation is completely defined by the axis and the angle of rotation. As mentioned at the beginning, any combination of rigid motions is equivalent to a single rotation plus a single translation. In particular, a pair of successive rotations about two different axes is equivalent to a single rotation about some other axis, but which one and through what angle? Quaternions were devised to find answers to those questions in a very efficient way. Though this post will not cover quaternions in great depth, a strong understanding of them will help the rest of the post make sense. An excellent review of quaternions can be found here.
A quaternion is usually written as $q = q_0 + q_1 i + q_2 j + q_3 k$, but it will be convenient to split out the imaginary part into a “vector” so we will write it instead as
$$\displaystyle q = q_0 + \vec{q} $$
Thus any quantity with an arrow above it is a pure quaternion. Any quantity with a hat (e.g. $\hat{q}$) is a pure quaternion with unit norm. To simplify notation, we will identify pure quaternions with regular vectors from $\mathbb{R}^3$ and use the familiar dot and cross products accordingly.
The Quaternion Exponential and Logarithm
If $q$ is a quaternion, the exponential $y = \exp(tq)$ is the solution to the initial value problem:
$$\displaystyle \begin{cases}\frac{dy}{dt} &= yq \\ y(0) &= 1 \end{cases} $$
This is formally the same as the definition of the familiar exponential function, but with quaternions instead of real numbers. The familiar properties of the exponential follow from this definition, so they also carry over to the quaternion exponential. All well and good, but we want a formula for $\exp(tq)$ into which we can plug the components of $q$. If we define $L$ to be the norm of the imaginary part of $q$, $L = |\vec{q}|$, then we have:
$$\displaystyle q = q_0 + L\hat{q} $$
From the definition of the exponential we get its power series representation:
$$\displaystyle \exp(tq) = \sum_{p=0}^\infty \frac{q^p}{p!} = \sum_{p=0}^\infty \frac{(q_0 + L\hat{q})^p}{p!} $$
Two facts will help simplify this sum.
Lemma 1: Let $a$ and $b$ be such that $ab = ba$. Then
$$\displaystyle \exp(a+b) = \exp(a)\exp(b) = \exp(b)\exp(a) $$
Proof: Expanding the power series for $\exp(a+b)$ using the binomial theorem:
$$\displaystyle \begin{aligned} \exp(a+b) &= \sum_{p=0}^\infty \frac{(a+b)^p}{p!} \\ &= \sum_{p=0}^\infty \frac{1}{p!} \left( \sum_{k=0}^p \frac{p!}{k! (p-k)!} a^k b^{p-k} \right) \\ &= \sum_{p=0}^\infty \sum_{k=0}^p \frac{a^k}{k!} \frac{b^{p-k}}{(p-k)!} \end{aligned} $$
The commutativity of $a$ and $b$ allows us to combine all the powers in each binomial term. Otherwise, we could not write $abba = a^2b^2$. Exchanging the order of summation and then re-indexing the sum over $p$:
$$\displaystyle \begin{aligned} \exp(a+b) &= \sum_{k=0}^\infty \sum_{p=k}^\infty \frac{a^k}{k!} \frac{b^{p-k}}{(p-k)!} \\ &= \sum_{k=0}^\infty \sum_{p=0}^\infty \frac{a^k}{k!} \frac{b^p}{p!} \\ &= \sum_{k=0}^\infty \frac{a^k}{k!} \left( \sum_{p=0}^\infty \frac{b^p}{p!} \right) \\ &= \exp(a)\exp(b) \end{aligned} $$
Repeating the process with $a$ and $b$ swapped establishes that $\exp(a+b) = \exp(b)\exp(a)$ also. ∎
Second, observe that $\hat{q}$ (the vector part of $q$ scaled to have unit norm) satisfies $ \hat{q}^2= \hat{q}\hat{q} = -\hat{q}\cdot\hat{q} + \hat{q}\times\hat{q} = -1 $ where the multiplication on the left-hand side is quaternion multiplication and $\cdot, \times$ the familiar vector dot and cross products. Like with the imaginary unit $i$, we therefore have:
$$\displaystyle \begin{aligned} \hat{q}^1 &= \hat{q} \\ \hat{q}^2 &= -1 \\ \hat{q}^3 &= -\hat{q} \\ \hat{q}^4 &= 1 \end{aligned} $$
Since $q_0$ (regarded as a quaternion) commutes with $\vec{q}$, from Lemma 1 we have:
$$\displaystyle \exp(tq) = \exp(tq_0 + tL\hat{q}) = \exp(tq_0)\exp(tL\hat{q}) = e^{tq_0}\sum_{p=0}^\infty \frac{(tL\hat{q})^p}{p!} $$
Hereafter, we will denote the exponential of a scalar $x$ by $e^x$ to distinguish it from the quaternion exponential which we denote by $\exp$. Now, analogous to the familiar $e^{it} = \cos(t) + i\sin(t)$, the cyclic pattern of the power of $\hat{q}$ then allow us to rephrase the exponential series in terms of the sine and cosine:
$$\displaystyle \exp(tq) = e^{tq_0}\left( \cos(tL) + \hat{q}\sin(tL) \right) $$
Wrapping up these conclusions into what will be a more convenient form:
$$\displaystyle \exp(tq) = e^{tq_0} \left( \cos(|\vec{q}|t) + \sin(|\vec{q}|t) \frac{\vec{q}}{|\vec{q}|} \right) $$
The logarithm is the inverse of the exponential. If $q = \log a$, then $\exp(q) = a$ from which we obtain:
$$\displaystyle \begin{aligned} a_0 +\vec{a} &= e^{q_0} \left( \cos(|\vec{q}|) + \sin(|\vec{q}|) \frac{\vec{q}}{|\vec{q}|} \right) \\ a_0 &= e^{q_0}\cos(|\vec{q}|) \\ \vec{a} &= e^{q_0}\sin(|\vec{q}|) \frac{\vec{q}}{|\vec{q}|} \\ q_0 &= \log(|a|) \\ \vec{q} &= \hat{a}\arctan{\left( \frac{|\vec{a}|}{a_0} \right)} \end{aligned} $$
Note that we distinguish between $|a|$, the norm of $a$ as a quaternion, and $|\vec{a}|$, the norm of its vector part alone. Putting the whole package in one place:
$$\displaystyle \log(q) = \log (|q|) + \hat{q}\arctan{\left( \frac{|\vec{q}|}{q_0} \right)} $$
Dual Numbers
A dual number $d = a + \epsilon b$ where $a,b\in\mathbb{R}$ and the “dual unit” $\epsilon$ satisfies $\epsilon^2 = 0$. Though $\epsilon$ itself is not a number, one can intuitively think of it as an “infinitesimally small” number (it is more rigorous to regard it as a nilpotent operator but the intuitive understanding will suffice for now). From this definition follows the rule for multiplication:
$$\displaystyle (a+\epsilon b)(c +\epsilon d) = ac + \epsilon(bc + ad) $$
We also define, for any differentiable function $f$:
$$\displaystyle f(a + \epsilon b) = f(a) + \epsilon b f'(a)$$
Here the intuitive sense of $\epsilon$ as an infinitesimal number makes itself useful. This definition is akin to the complex step method of automatic differentiation. For future use, we record some functions of dual numbers:
$$\displaystyle \begin{aligned} e^{a + \epsilon b} &= e^a + \epsilon b e^a \\ \sin(a+\epsilon b) &= \sin(a) + \epsilon b\cos(a) \\ \cos(a + \epsilon b) &= \cos(a) – \epsilon b\sin(a) \\ \text{sinc}(a + \epsilon b) &= \text{sinc}(a) + \epsilon b\frac{a\cos(a) – \sin(a)}{a^2} \end{aligned} $$
Where the sine cardinal is:
$$\displaystyle \text{sinc}(x) = \begin{cases} \frac{\sin(x)}{x} & x\neq 0 \\ 1 & x=0 \end{cases} $$
Dual Quaternions
A dual quaternion is analogous to a dual number except the two components are quaternions:
$$\displaystyle q= r + \epsilon d$$
Quaternions are a special case of dual quaternions where the dual part is, of course, zero.
The Dual Quaternion Exponential
The dual quaternion exponential is the quaternion exponential where $q$ is now understood to be a dual quaternion:
$$\displaystyle \begin{aligned} \exp(tq) &= e^{tq_0}\left( \cos(|\vec{q}|t) + \frac{\sin(|\vec{q}|t)}{|\vec{q}|}\vec{q} \right) \\ &= e^{tr_0 + \epsilon td_0}\left( \cos(|\vec{r}+\epsilon\vec{d}|t) + t\text{sinc}(|\vec{r}+\epsilon\vec{d}|t)(\vec{r}+\epsilon\vec{d}) \right) \end{aligned} $$
It remains to bushwhack through a thicket of bookkeeping to expand these expressions into their real and dual parts, but at the end we’ll have our exponential. Buckle up.
$$\displaystyle \begin{aligned} |\vec{r} + \epsilon\vec{d} |^2 &= \left( (\vec{r} + \epsilon\vec{d})\cdot(\vec{r} + \epsilon\vec{d}) \right) \\ &= |\vec{r}|^2 + 2\epsilon(\vec{r}\cdot\vec{d}) \end{aligned}$$
Therefore:
$$\displaystyle |\vec{r} + \epsilon\vec{d}| = |\vec{r}| + \epsilon\frac{\vec{r}\cdot\vec{d}}{|\vec{r}|} = |\vec{r}| + \epsilon p $$
On to the pieces of the exponential:
$$\displaystyle e^{tr_0 + \epsilon td_0} = e^{tr_0} + \epsilon td_0 e^{tr_0} = e^{tr_0}(1 + \epsilon td_0) $$
$$\displaystyle \begin{aligned} \cos(|\vec{r}+\epsilon\vec{d}|t) &= \cos(|\vec{r}|t + \epsilon pt) \\ &= \cos(\theta) – \epsilon pt\sin(\theta) \end{aligned} $$
Where for convenience we have defined $\theta = |\vec{r}|t$ since that quantity will appear frequently.
$$\displaystyle \begin{aligned} \text{sinc}(|\vec{r}+\epsilon\vec{d}|t) &= \text{sinc}(|\vec{r}|t + \epsilon pt) \\ &= \text{sinc}(\theta) + \epsilon pt\text{sinc}'(\theta) \\ &= \text{sinc}(\theta) + \epsilon pt\frac{\theta\cos(\theta) – \sin(\theta)}{\theta^2} \end{aligned} $$
Putting it all together:
$$\displaystyle \begin{aligned} \exp(tq) &= e^{tr_0}(1 + \epsilon td_0)\Big[ \cos(\theta) – \epsilon pt\sin(\theta) \\ &+ t\Big( \text{sinc}(\theta) + \epsilon pt\text{sinc}'(\theta)\Big)(\vec{r} + \epsilon\vec{d}) \Big] \end{aligned} $$
Multiplying out the products and combining the real and dual parts:
$$\displaystyle \begin{aligned} \exp(tq) &= e^{tr_0}(1 +\epsilon td_0)\Big[ \cos(\theta) + t\text{sinc}(\theta)\vec{r} \\ &+ \epsilon\Big( t\text{sinc}(\theta)\vec{d} – pt\sin(\theta) + pt^2\text{sinc}'(\theta)\vec{r} \Big)\Big] \\ &= e^{tr_0}\Big( \cos(\theta) + t\text{sinc}(\theta)\vec{r} \\ &+ \epsilon \Big[ t\text{sinc}(\theta)\vec{d} + td_0(\cos(\theta) + t\text{sinc}(\theta)\vec{r}) – pt\sin\theta + pt^2\text{sinc}'(\theta)\vec{r} \Big] \Big) \end{aligned} $$
For simplicity, we omit expanding $\text{sinc}'(\theta) = \frac{(\theta\cos(\theta) – sin(\theta))}{\theta}$. As a check, observe that if $d = 0$ we recover the quaternion exponential and if $r=0$ and $d_0 =0$, corresponding to a pure translational velocity, we obtain $exp(q) = 1 + \epsilon t\vec{d}$ which is a pure displacement as we expect. To prove that our result is correct, however, we need to verify that it satisfies the defining differential equation mentioned earlier. We will use the fact that for any function $f$:
$$\displaystyle \frac{d}{dt}\left( e^{tr_0} f\right) = e^{tr_0}(f’ + r_0 f) $$
And we will start by simplifying the expression for $\exp(tq)$. Define:
$$\displaystyle \text{crs}(\theta) = \cos(\theta) + \frac{\vec{r}}{|\vec{r}|}\sin(\theta) $$
Then:
$$\displaystyle \begin{aligned} \exp(tq) = \sigma = e^{tr_0}\Bigg( \text{crs}(\theta) + \epsilon\Bigg[ \frac{\sin(\theta)}{|\vec{r}|}\vec{d} &+ td_0\text{crs}(\theta) – pt\sin(\theta) \\ &+ \frac{p}{|\vec{r}|^2}(\theta\cos(\theta)-\sin(\theta) \Bigg] \Bigg) \end{aligned}$$
and the derivative is:
$$\displaystyle \begin{aligned} \dot{\sigma} &= e^{tr_0}\Bigg( r_0\text{crs}(\theta) – |\vec{r}|\sin(\theta) + \cos(\theta)\vec{r} \\ &+ \epsilon \Bigg[ r_0\frac{\sin(\theta)}{|\vec{r}|}\vec{d} + \cos(\theta)\vec{d} + (r_0t+ 1)d_0\text{crs}(\theta) + td_0(-|\vec{r}|\sin(\theta) + \cos(\theta)\vec{r}) \\ &- (r_0t+1)p\sin(\theta) – pt|\vec{r}|\cos(\theta) + \frac{r_0 p}{|\vec{r}|^2}(\theta\cos(\theta) -\sin(\theta))\vec{r} – pt\sin(\theta)\vec{r} \Bigg] \Bigg) \end{aligned} $$
$\dot{\sigma}$ needs to match $\sigma q = \sigma (r + \epsilon d)$:
$$\displaystyle \begin{aligned} \sigma (r +\epsilon d) &= e^{tr_0}\Bigg( \text{crs}(\theta)r \\ &+ \epsilon\Bigg[ \text{crs}(\theta)d \\ &+ \Bigg( \frac{\sin(\theta)}{|\vec{r}|}\vec{d} + td_0\text{crs}(\theta) – pt\sin(\theta) + \frac{p}{|\vec{r}|^2}(\theta\cos(\theta) – \sin(\theta))\vec{r} \Bigg)r \Bigg]\Bigg) \end{aligned} $$
We now need to work out some direct quaternion multiplications:
$$\displaystyle \text{crs}(\theta)r = \left( \cos(\theta) +\hat{r}\sin(\theta) \right)(r_0 + \vec{r}) = r_0\text{crs}(\theta) – |\vec{r}|\sin(\theta) +\vec{r}\cos(\theta) $$
$$\displaystyle \vec{r}r = -|\vec{r}|^2 + r_0\vec{r} $$
$$\displaystyle \vec{d}{r} = -\vec{d}\cdot\vec{r} + r_0\vec{d} + \vec{d}\times\vec{r} = -p|\vec{r}| +r_0\vec{d} + \vec{d}\times\vec{r} $$
$$\displaystyle \text{crs}(\theta)d = d_0\cos(\theta) – p\sin(\theta) + \vec{d}\cos(\theta) + d_0\hat{r}\sin(\theta) + (\hat{r}\times\vec{d})\sin(\theta) $$
With these facts in hand we can rewrite:
$$\displaystyle \begin{aligned} \sigma(r +\epsilon d) &= e^{tr_0}\Bigg( r_0\text{crs}(\theta) – |\vec{r}|\sin(\theta) + \vec{r}\cos(\theta) \\ &+ \epsilon\Bigg[ d_0\cos(\theta) – p\sin(\theta) + \vec{d}\cos(\theta) + d_0\hat{r}\sin(\theta) + (\hat{r}\times\vec{d})\sin(\theta) \\ &+ \frac{\sin(\theta)}{|\vec{r}|}(-\vec{d}\cdot\vec{r} +r_0\vec{d} +\vec{d}\times\vec{r}) \\ &+ td_0(r_0\text{crs}(\theta)- |\vec{r}|\sin(\theta) +\vec{r}\cos(\theta)) \\ &-pt\sin(\theta)r_0 – pt\sin(\theta)\vec{r} \\ &+ \frac{p}{|\vec{r}|^2}(\theta\cos(\theta) – \sin(\theta))(-|\vec{r}|^2+r_0\vec{r}) \Bigg] \Bigg) \end{aligned} $$
Some small simplifications are possible:
$$\displaystyle \begin{aligned} \sigma(r +\epsilon d) &= e^{tr_0}\Bigg( r_0\text{crs}(\theta) – |\vec{r}|\sin(\theta) + \vec{r}\cos(\theta) \\ &+ \epsilon\Bigg[ d_0\text{crs}(\theta) – p\sin(\theta) + \vec{d}\cos(\theta) \\ &+ r_0\vec{d}\frac{\sin(\theta)}{|\vec{r}|} – p\sin(\theta) \\ &+ td_0(r_0\text{crs}(\theta)- |\vec{r}|\sin(\theta) +\vec{r}\cos(\theta)) \\ &-pt\sin(\theta)r_0 – pt\sin(\theta)\vec{r} \\ &-p\theta\cos(\theta) + p\sin(\theta) + \frac{pr_0\vec{r}}{|\vec{r}|^2}(\theta\cos(\theta) – \sin(\theta)) \Bigg] \Bigg) \end{aligned} $$
Comparing to the derivative $\dot{\sigma}$, the exponential prefactor is identical as is the real part. So we can focus now on the dual parts and ignore the prefactor. Expanding and regrouping some terms in the equation for $\dot{\sigma}$:
$$\displaystyle \begin{aligned} e^{-tr_0}\text{Du}(\dot{\sigma}) &= r_0\frac{\sin(\theta)}{|\vec{r}|}\vec{d} + \cos(\theta)\vec{d} + (r_0t+ 1)d_0\text{crs}(\theta) + td_0(-|\vec{r}|\sin(\theta) + \cos(\theta)\vec{r}) \\ &- (r_0t+1)p\sin(\theta) – pt|\vec{r}|\cos(\theta) + \frac{r_0 p}{|\vec{r}|^2}(\theta\cos(\theta) -\sin(\theta))\vec{r} – pt\sin(\theta)\vec{r} \\ &= td_0(r_0\text{crs}(\theta) – |\vec{r}|\sin(\theta) + \vec{r}\cos(\theta)) \\ &+r_0\frac{\sin(\theta)}{|\vec{r}|}\vec{d} + \vec{d}\cos(\theta) + d_0\text{crs}(\theta) \\ &-p\sin(\theta) – pr_0t\sin(\theta) – pt|\vec{r}|\cos(\theta) \\ &+ \frac{pr_0\vec{r}}{|\vec{r}|^2}(\theta\cos(\theta) -\sin(\theta)) – pt\sin(\theta)\vec{r} \end{aligned} $$
Examining these two expressions (remember that $\theta = |\vec{r}|t$) establishes that $\dot{\sigma} = \sigma q$, and it is easily seen that $\sigma = 1$ when $t=0$, so $\sigma = \exp(tq)$. ∎
The Dual Quaternion Logarithm
We have the logarithm for regular quaternions already:
$$\displaystyle \log(q) = \log (|q|) + \hat{q}\arctan{\left( \frac{|\vec{q}|}{q_0} \right)} $$
So to get the logarithm of a dual quaternion, we proceed as with the exponential and let $q = r + \epsilon d$.
$$\displaystyle \log(r + \epsilon d) = \log(|r + \epsilon d|) + \frac{\vec{r} + \epsilon\vec{d}}{|\vec{r} + \epsilon\vec{d}|} \arctan\left( \frac{|\vec{r} +\epsilon\vec{d}|}{r_0+\epsilon d_0} \right) $$
We will need the following formula for division of dual numbers:
$$\displaystyle \frac{a_0 + \epsilon a_1}{b_0 + \epsilon b_1} = \frac{a_0}{b_0} + \epsilon\frac{a_1 – \frac{a_0}{b_0}b_1}{b_0} $$
It will be convenient to work out the real and dual parts of the norm terms in advance:
$$\displaystyle \begin{aligned} |r + \epsilon d|^2 &= (r^* + \epsilon d^*)(r^* + \epsilon d^*)(r+\epsilon d) \\ &= (r^* r) +\epsilon(d^*r + r^*d) \\ &= (r_0^2 + \vec{r}\cdot\vec{r}) + 2\epsilon (d_0 r_0 + \vec{d}\cdot\vec{r}) \\ |r + \epsilon d| &= \sqrt{r_0^2 + \vec{r}\cdot\vec{r}} + \epsilon\frac{d_0r_0 + \vec{d}\cdot\vec{r}}{\sqrt{r_0^2 + \vec{r}\cdot\vec{r}}} \end{aligned}$$
$$\displaystyle |\vec{r} + \epsilon\vec{d}|^2 = |\vec{r}| + \epsilon\frac{\vec{d}\cdot\vec{r}}{|\vec{r}|} = |\vec{r}|+\epsilon p $$
Substituting into the logarithm formula:
$$\displaystyle \begin{aligned} \log(r+\epsilon d) &= \log\left( \sqrt{r_0^2 + \vec{r}\cdot\vec{r}} +\epsilon\frac{d_0r_0 + \vec{d}\cdot\vec{r}}{\sqrt{r_0^2 + \vec{r}\cdot\vec{r}}} \right) \\ &+ \frac{\vec{r}+ \epsilon\vec{d}}{|\vec{r}| + \epsilon p}\arctan\left( \frac{|\vec{r}| + \epsilon p}{r_0 + \epsilon d_0} \right) \end{aligned}$$
Expanding:
$$\displaystyle \begin{aligned} \log(r+\epsilon d) &= \frac12\log(r_0^2 + \vec{r}\cdot\vec{r}) + \epsilon\frac{d_0r_0 + \vec{d}\cdot\vec{r}}{r_0^2 + \vec{r}\cdot\vec{r}} \\ &+ \left( \hat{r} + \epsilon\frac{\vec{d} – p\hat{r}}{|\vec{r}|} \right)\left( \arctan\left( \frac{|\vec{r}|}{r_0} \right) + \epsilon \frac{1}{1 + \frac{|\vec{r}|^2}{r_0^2}}\frac{r_0p – |\vec{r}|d_0}{r_0^2} \right) \\ &= \frac12\log(r_0^2 + \vec{r}\cdot\vec{r}) + \epsilon\frac{d_0r_0 + \vec{d}\cdot\vec{r}}{r_0^2 + \vec{r}\cdot\vec{r}} + \hat{r}\arctan\left( \frac{|\vec{r}|}{r_0} \right) \\ &+ \epsilon\left[ \frac{\vec{d}-p\hat{r}}{|\vec{r}|}\arctan\left( \frac{|\vec{r}|}{r_0}\right) +\frac{r_0p – |\vec{r}|d_0}{r_0^2 + |\vec{r}|^2}\hat{r} \right] \end{aligned} $$
To confirm that this is indeed the logarithm, we need to check that $\log(\exp(q)) = q$. Let $q = r + \epsilon d$. Then, using the formula we found earlier for the exponential:
$$\displaystyle \begin{aligned} \exp(q) = r’ + \epsilon d’ &= e^{r_0}(\cos(\theta) + \hat{r}\sin(\theta)) \\ &+ e^{r_0}\epsilon\Bigg[ d_0(\cos(\theta) + \hat{r}\sin(\theta)) + \frac{\sin(\theta)}{|\vec{r}|}\vec{d} \\ &- p\sin(\theta) + p\left( \cos(\theta)-\frac{\sin(\theta)}{\theta}\hat{r} \right) \Bigg] \end{aligned} $$
So:
$$\displaystyle \begin{aligned} r’ &= e^{r_0}(\cos(\theta) + \hat{r}\sin(\theta)) \\ r’_0 &= e^{r_0}\cos(\theta) \\ \vec{r}’ &= e^{r_0}\hat{r}\sin(\theta) \\ \hat{r}’ &= \hat{r} \\ |\vec{r}’| &= e^{r_0}\sin(\theta) \\ |r| &= (r’_0)^2 + \vec{r}’\cdot\vec{r}’ = e^{2r_0} \\ d’ &= e^{r_0}\left[ d_0(\cos(\theta) + \hat{r}\sin(\theta) + \frac{\sin(\theta)}{|\vec{r}|}\vec{d} – p\sin(\theta) + p\left( \cos(\theta) – \frac{\sin(\theta)}{\theta} \right)\hat{r} \right] \\ d’_0 &= e^{r_0}(d_0\cos(\theta) – p\sin(\theta)) \\ \vec{d}’ &= e^{r_0}\left( d_0\hat{r}\sin(\theta) + \frac{\sin(\theta)}{|\vec{r}|}\vec{d} + p\left( \cos(\theta) – \frac{\sin(\theta)}{\theta} \right)\hat{r} \right) \\ d’_0r’_0 &= e^{2r_0}(d_0\cos^2(\theta) – p\sin(\theta)\cos(\theta) \\ p’ &= \vec{d}’\cdot\hat{r}’ = e^{r_0}\left( d_0\sin(\theta) + p\frac{\sin(\theta)}{\theta} + p\left( \cos(\theta) – \frac{\sin(\theta)}{\theta} \right)\right) \\ &= e^{r_0}(d_0\sin(\theta) + p\cos(\theta)) \\ t &= 1 \\ \theta &= |\vec{r}| \\ \arctan\left( \frac{|\vec{r}|}{r_0} \right) &= \arctan\left( \frac{e^{r_0}\sin(\theta)}{e^{r_0}\cos(\theta)} \right) = \arctan(\tan(\theta)) = \theta \end{aligned} $$
Substituting these facts into the logarithm of the exponential:
$$\displaystyle \begin{aligned} \log(r’+\epsilon d’) &= \frac12\log((r’_0)^2 + \vec{r}’\cdot\vec{r}’) + \epsilon\frac{d’_0r’_0 + \vec{d}’\cdot\vec{r}’}{(r’_0)^2 + \vec{r}’\cdot\vec{r}’} + \hat{r}’\arctan\left( \frac{|\vec{r}’|}{r’_0} \right) \\ &+ \epsilon\left[ \frac{\vec{d}’-p’\hat{r}’}{|\vec{r}’|}\arctan\left( \frac{|\vec{r}’|}{r’_0}\right) +\frac{r’_0 p’ – |\vec{r}’|d’_0}{(r’_0)^2 + |\vec{r}’|^2}\hat{r}’ \right] \\ &= \frac12\log(e^{2r_0}) + \epsilon \frac{e^{2r_0}d_0}{e^{2r_0}} + \theta\hat{r} \\ &+ e^{r_0} \epsilon\Bigg[ \frac{d_0\hat{r}\sin(\theta) + \frac{\sin(\theta)}{\theta}\vec{d} + p\left(\cos(\theta) – \frac{\sin(\theta)}{\theta}\right)\hat{r} – (d_0\sin(\theta) + p\cos(\theta))\hat{r}}{e^{r_0}\sin(\theta)}\theta \\ &+ \frac{e^{r_0}(\cos(\theta)(d_0\sin(\theta) + p\cos(\theta)) – \sin(\theta)(d_0\cos(\theta) – p\sin(\theta))}{e^{2r_0}}\hat{r} \Bigg] \\ &= r_0 + \epsilon d_0 + \vec{r} + \epsilon\left[ \frac{\frac{\sin(\theta)}{\theta} (\vec{d} -p\hat{r}}{\sin(\theta)}\theta + p\hat{r}\right] \\ &= r + \epsilon d_0 + \epsilon\vec{d} \\ &= r + \epsilon d \end{aligned} $$
So the logarithm is indeed correct. ∎
Conclusion
We have the dual quaternion exponential:
$$\displaystyle \begin{aligned} \exp(t(r + \epsilon d)) &= e^{tr_0}(\cos(\theta) + \hat{r}\sin(\theta)) \\&+ \epsilon e^{tr_0}\Bigg[ td_0(\cos(\theta) + \hat{r}\sin(\theta)) +\frac{\sin(\theta)}{|\vec{r}|}\vec{d} – pt\sin(\theta) \\ &+ p\left(\cos(\theta) – \frac{\sin(\theta)}{\theta}\right)\hat{r} \Bigg] \end{aligned}$$
where $\theta = |\vec{r}|t$ and $p = \vec{d}\cdot\hat{r}$. We also have the dual quaternion logarithm:
$$\displaystyle \begin{aligned} \log(r + \epsilon d) &= \log(|r|) + \hat{r}\arctan\left(\frac{|\vec{r}|}{r_0}\right) \\ &+ \epsilon\left[ \frac{d_0r_0 + \vec{d}\cdot\vec{r}}{|r|^2} + \frac{\vec{d} – p\hat{r}}{|\vec{r}|}\arctan\left(\frac{|\vec{r}|}{r_0}\right) +\frac{r_0 p – |\vec{r}|d_0}{|r|^2}\hat{r} \right] \end{aligned} $$
We obtained these from the corresponding formulas for regular quaternions (which we also derived) by exploiting properties of dual numbers. This required a deluge of calculations, but all of them were straightforward plug-and-chug operations and we arrived at formulas that work for any dual quaternions. In contrast, all existing derivations that I have found only apply for pure dual quaternions where $r_0 = d_0 = 0$ and involve exploiting some convenient structure that arises from that restriction.