Understanding quaternions
Name:
Due October 21st, in lab
This worksheet is intended as a short 60 min exercise to be done in groups of 1-3 people.
Quaternions
Multiply the complex numbers \( a = 3 + 4 i \) and \( b = 3 - 4 i \). Note that b is the conjugate of a.
We will show that if we have a quaternion \( q = (1, -1, 0, 1) \), that \( q q^{-1} = (0, 0, 0, 1) \). A quaternion \(q = (x, y, z, w) \) is often denoted \(q = (\mathbf{v}, w) \), where \( \mathbf{v} = (x, y, z) \) is the vector part and \( w \) is the scalar part. Quaternions extend the complex numbers. With this perspective, a quaternion corresponds to \(q = x\hat{i} + y\hat{j} + z\hat{k} + w\), where \(\hat{i}^2 = \hat{j}^2 = \hat{k}^2 = -1\).
Recall that
where
Given \(q = (1, -1, 0, 1) \). Compute the following expressions
-
\( ||q||^2 \)
-
\( \bar{q} \)
-
\( q^{-1} \)
Let \(q_1 = q \) and \( q_2 = q^{-1} \). If \( q_1 = (\mathbf{v_1}, w_1) \) and \( q_2 = (\mathbf{v_2}, w_2) \), then
Compute the following expressions
-
\( w_1 \mathbf{v_2} \)
-
\( w_2 \mathbf{v_1} \)
-
\( \mathbf{v_1} \times \mathbf{v_2} \)
-
\( w_1 w_2 \)
-
\( \mathbf{v_1} \cdot \mathbf{v_2} \)
-
\( w_1 w_2 - \mathbf{v_1} \cdot \mathbf{v_2} \)
-
\( q q^{-1} \)
Angle/Axis
Which subset of quaternions correspond to rotations?
Recall that the relationship between some quaternions and an angle/axis rotation is
-
What is the quaternion corresponding to a 30 degree rotation around the Y axis?
-
Suppose we have a quaternion [0.18301, 0.18301, 0, 0.9659]. What is the angle and axis corresponding to this quaternion?
Matrix
In class, we derived the rotation matrix corresponding to a quaternion \( q = (x, y, z, w) = (\bar{v}, w ) \).
Suppose we have a quaternion corresponding to a 45 degree rotation around the Z axis. Verify that the matrix above reduces to a Z rotation matrix \( R_Z(45) \).
Recall the algorithm for extracting a quaternion from a rotation matrix.
-
solve for \( w^2 \), \( x^2 \), \( y^2 \), and \( z^2 \)
-
Find the term with the largest value
-
Based on the largest component, compute the remaining terms using the off-diagonal matrix elements.
For example, if \( w^2 \) is the largest, we would then solve for x, y, and z using the expressions for \( w x \), \( w y \), and \( w z \).
Consider the matrix \( R_Z(45) \) from the previous question. Apply this algorithm to obtain the original quaternion back.