17

I'm reading 3D math primer for graphics and game development by Fletcher Dunn and Ian Parberry. On page 170, the logarithm of quaternion is defined as

\begin{align} \log \mathbf q &= \log \left( \begin{bmatrix} \cos \alpha & \mathbf n \sin \alpha \end{bmatrix} \right) \\\\ &\equiv \begin{bmatrix} 0 & \alpha \mathbf n \end{bmatrix} \end{align}

I don't see how $\log \left( \begin{bmatrix} \cos \alpha & \mathbf n \sin \alpha \end{bmatrix} \right)$ is equal to $\begin{bmatrix} 0 & \alpha \mathbf n \end{bmatrix}$. Can anyone help me out?

Thanks.

  • I don't see how you can have a log of a quat, since quat addition is commutative but multiplication not. The standard rule for logarithms, log(ab)=log(a)+log(b) would not apply except over a subset where log(ab)=log(ba). Sorry, Lie algebra is above my paygrade. There are other unreal objects that have perfectly valid logarithms, like elements of a finite field with a single generator of the multiplicative group. I have in mind the Hebrew alphabet and the practice of gematria, as it maps onto the integers 1 to 22, and arithmetic is done modulo 23. – richard1941 Jul 21 '17 at 17:54
  • @richard1941 The log map is still defined even if the group operator is not commutative: see e.g. https://en.wikipedia.org/wiki/Logarithm_of_a_matrix#Properties – Gus May 10 '19 at 18:39

2 Answers2

18

I can't see the page in Google Books, but what you apparently have there is the logarithm of a unit quaternion $\mathbf q$, which has scalar part $\cos(\theta)$ and vector part $\sin(\theta)\vec{n}$ where $\vec{n}$ is a unit vector.

Since the logarithm of an arbitrary quaternion $\mathbf q=(s,\;\;v)$ is defined as

$\ln \mathbf q=\left(\ln|\mathbf q|,\;\;\left(\frac1{\|v\|}\arccos\frac{s}{|q|}\right)v\right)$

where $|\mathbf q|$ is the norm of the quaternion and $\|v\|$ is the norm of the vector part (and note that the vector part of $\ln\mathbf q$ has a scalar multiplier); applying that formula to a unit quaternion yields a scalar part of $0$ (the logarithm of the norm of a unit quaternion is zero), and you should now be able to derive the formula for the vector part.

  • Hi JM, it's possible my browser's not rendering that correctly, or maybe there's a typo in the markup, should there be a comma between ln |q| and v/|v|? Tweaking that line to $\ln q=(\ln|q|,\frac{v}{\|v\|}\arccos\frac{s}{|q|})$ makes it appear the way I think it should. (Currently it's q=(\ln\\,|q|\;\;...), which looks like parts might be double-escaped.) – John P Nov 16 '18 at 09:33
  • 1
    @John, I defined the "arbitrary quaternion" to be $q=(s;;v)$ in the preceding sentence, so that convention is followed in the logarithm. If you prefer, you can separate the scalar and vector parts with a comma in your own notation. – J. M. ain't a mathematician Dec 31 '18 at 10:32
  • Thanks, that makes sense. There's nothing wrong with minimal notation, I just didn't recognize the spacing as a part of the formatting. – John P Jan 06 '19 at 19:32
  • @Nikos, you've effectively altered the meaning of my expression, as it is no longer consistent with the definition $q=(s;;v)$ I gave earlier for the quaternion. I would not have minded an edit if you had made the effort to be notationally consistent, but you have not. – J. M. ain't a mathematician Oct 13 '19 at 06:01
  • @J.M.isapoormathematician I'm sorry. I misunderstood. – KeyC0de Oct 13 '19 at 07:53
  • Is the logarithm not defined for the quaternion $1 + 0i + 0j + 0k$ then? Because the norm of $v$ would be zero, so the fraction NaN. – lucidbrot Jun 09 '22 at 13:01
5

Just recall $\exp(\alpha i) = \cos \alpha + i \sin \alpha$ for complex numbers, the quaternion (remember a quaternion is just 3 complex numbers which all have the same real part) version is by direct analogue and take logarithm of both sides.