Derivation for angular acceleration from quaternion profile Given a profile of unit quaternions $q(t)$ that represents the orientation of a body over time, I like to get the angular acceleration $\dot \omega (t)$.
I tried to find a formula myself, but I get two different results for two different derivations.
Derivation 1
Starting from the kinematic equations
$$\omega=2\dot{q}\hat{q}$$
$$\dot{\omega}=2(\ddot{q}\hat{q}+\dot q \hat{\dot{q}})$$
And using the property of conjugate quaternions:
$$\dot\omega=2\ddot q \hat q.$$
Derivation 2
Again, taking the kinematic equation
$$\dot q = \frac 1 2 \omega q$$
But now taking the derivative of $q$ w.r.t. $t$ gives
$$ \ddot q=\frac 1 2 (\dot \omega q+\omega\dot q) $$
After substituting the formula for $\omega$
$$ \ddot q=\frac{1}{2} (\dot \omega q+2 \dot q\hat q \dot q)$$
Finally, the result after multiplying both sided by $\hat q$ and rearranging is
$$\dot \omega  = 2\ddot q\hat q -2(\dot q \hat q)^2.$$
Which of these derivations is correct, and why?
I have already consulted several sources, where I seem to find both formulas. 
For example here for derivation 1 (Quaternions, Finite Rotation and
Euler Parameters by Arend L. Schwab (2002).) and here for derivation 2. I'm new to using quaternions, so maybe I'm missing some mathematical concept.
 A: I think that the point is that the "extra" term has zero "vector" part, but a non-vanishing scalar part. See eqn (17) of your first reference which, I believe, actually agrees with your second reference. The quaternion representing $\omega$ has zero scalar part, and the same is true for $\dot{\omega}$. So the scalar parts of the two terms on the right of your second derivation should cancel each other. The result of the first derivation is incorrect (not sure how you got it, you just say "property of conjugate quaternions") but if you are only interested in the vector components, it doesn't matter, you just discard the scalar part.

EDIT following OP comment.
The extra term, in full, is $\dot{q}\circ\hat{q}\circ\dot{q}\circ\hat{q}$ where $\circ$ stands for quaternion multiplication, and $\hat{q}$ is the conjugate of $q$. From the very first relation, $\omega=2\dot{q}\circ\hat{q}$, this is proportional to $\omega\circ\omega$ where $\omega$ is the quaternion representing the angular velocity. Writing this as $(0,\vec{\omega})$, where $\vec{\omega}$ is the angular velocity vector, and recalling the general formula for quaternion multiplication
of two quaternions $a=(a_0,\vec{a})$ and $b=(b_0,\vec{b})$,
$$
a\circ b = (a_0b_0-\vec{a}\cdot\vec{b},a_0\vec{b}+b_0\vec{a}+\vec{a}\times\vec{b}),
$$
we note that both the scalar parts of $\omega$ are zero, and also that the vector product of $\vec{\omega}$ with itself is zero. So
$$
\omega\circ \omega = (-|\vec{\omega}|^2,\vec{0}) .
$$
So this term does not come into the expression for the vector part of $\dot{\omega}$, although to make the equation correct, as a relation between quaternions, it should be present. 
When you did the final step in your first derivation, you simply dropped the scalar part of $\dot{q}\hat{\dot{q}}$. That is the reason for the apparent discrepancy.
As a postscript, I should add that it is not too difficult to see how this exactly cancels the scalar part of the $\ddot{q}\circ\hat{q}$ term (as it must). Because $q$ is a unit quaternion, the double derivative of its squared norm with respect to time must vanish. So
$$
\frac{d^2}{dt^2} |q|^2 = \frac{d^2}{dt^2} \bigl(q\circ \hat{q}\bigr)_0 = 0 .
$$
Expanding this out
$$
\bigl(\ddot{q}\circ \hat{q}\bigr)_0 + \bigl(q\circ \ddot{\hat{q}}\bigr)_0  + 2\bigl(\dot{q}\circ \dot{\hat{q}}\bigr)_0 = 0 .
$$
The first two terms are equal to each other
$$
\bigl(\ddot{q}\circ \hat{q}\bigr)_0 = \bigl(q\circ \ddot{\hat{q}}\bigr)_0 
= \ddot{q}_0q_0 + \ddot{\vec{q}}\cdot\vec{q} .
$$
Hence
$$
\bigl(\ddot{q}\circ \hat{q}\bigr)_0 + \bigl(\dot{q}\circ \dot{\hat{q}}\bigr)_0 = 0 
$$
as we should expect.
