Version 12 of Quaternion

Updated 2004-10-08 18:43:08

GWM Quaternions are a generalised complex number which have had a lot of use in scientific analysis of 3 dimensional space, navigation and guidance systems for rockets etc. Invented (or discovered?) by Sir W Hamilton on his way to a meeting, he stopped at the side of a bridge in Dublin and scratched the equation into the stone. The bridge is now known as Hamilton's Bridge or Brougham Bridge. (See http://math.ucr.edu/home/baez/Octonions/node24.html for some pictures of the bridge.)

Quaternions can be thought of as rotations, and consist of 4 real components. http://mathworld.wolfram.com/Quaternion.html

For comparison with Complex Numbers, they can be written:

 q = q0 + q1.i + q2.j + q3.k

where i,j,k are all square roots of -1 AND all different. i,j,k obey the following rules:

 i*i = j*j = k*k = ijk = -1
 i*j = k
 j*k = i
 k*i = j

Lars H: Note that quaternion multiplication is not commutative. In the non-real part, it is actually anti-commutative: j*i=-i*j, k*j=-j*k, i*k=-k*i.

GWM Indeed, a quaternion can be thought of as a transformation (also representable by a matrix); rotation matrices are not commutative. (Rotate a pencil about its long axis then its perpendicular axis through the makers name, the result is quite different from the reverse order of rotations).

Using these rules 2 quaternions can be multiplied to make a new quaternion which obeys the same rules. Thus the product of 2 quaternions results in another quaternion - it is a closed system of 'numbers'. If we want to visualise a quaternion, consider i,j,k to be the X,Y,Z axes of space and the q1,q2,q3 is a position in space (or a vector) and q0 a magnitude associated with that position.

Note that the products of i with j, j with k etc are similar to the right hand rule for cross product of 2 vectors. Thus if a quaternion relates in some way to a physical field, then the product of quaternions can represent such effects as gyroscopic precession, spin precession in atoms etc.

Lars H: The physical usefulness of quaternions is highly debatable. In the late 19th century they were indeed used for calculations in electromagnetism, but mostly because the properties of the vector cross product were seen as too queer for it to be a proper mathematical operation. As the vector formalism was simpler and more to the point, it won the battle for dominance. The only lasting impression the quaternions made is the use of i,j,k for basis vectors in 3-dimensional space.

GWM Nonetheless, if you have flown in a commercial airliner in the last 20 years or so its gyro compass data was processed into the position of your aircraft using a quaternion. Quaternions are used in calculation of Pauli spin matrices (particle physics). That is an awful lot of quaternions actually in use. Although not used as much as vector forms, Quaternions should be part of the armoury for dealing with vectors, and they represent another aspect of maths that real & complex numbers are not the only valid mathematical systems. In visual simulation (and games) many matrices (eg to rotate a persons simulated arm) are constructed from Quaternions as the interpolation of a quaternion is easier and smoother than interpolating Euler angles.

An important class of quaternions is a normalised or unit quaternion (one where q0^2+q1^2+q2^2+q3^2 equals 1); the product of 2 unit quaternions is still a unit quaternion. If the q0 parameter is regarded as a rotation about the vector (q1,q2,q3) then the product quaternion is equivalent to the total rotation produced by applying the rotation of the first quaternion to an object rotated by the second quaternion. Thus quaternions relate strongly to rotation matrices. They have the advantage over Euler Angles that they do not have singularities and are a more linear rate of change when used to represent the attitude of a vehicle. (Imagine an aeroplane suddenly turning nose upward; as the nose goes through vertical the direction of flight of your aircraft changes from due North to due South in zero seconds, a problem for integrating Euler angles).

Non-unit quaternions can be used to express the distortion of time and space expressed in Einstein's Relativistic relations.

MS Hey, memories ...

The configuration space (space of positions) of a rigid body in 3D is a 6-dimensional manifold. It cannot be covered by a single coordinate map, there are always singularities if you use only 6 coordinates (position of the center of mass and Euler angles, for instance).

Motion simulations thus require either code to deal with the singular positions (and the loss of accuracy near them), or else the use of redudant coordinates with constraints. The cheapest is to use the cartesian coordinates of the center of mass, and a unit quaternion for the attitude.

The state space of the body (position and velocity, or position and momentum depending on the type of equations used) can then be described by a vector in R^13 subject to one constraint:

  • cartesian coordinates of center of mass
  • unit quaternion for attitude (constraint: norm is 1)
  • cartesian components of velocity of center of mass
  • cartesian components of angular velocity

For a suitable choice of coordinate systems, the equations of motion come out with very nice properties. It also forms the basis of a very nice description for multibody systems (systems of rigid bodies with constraints, i.e., mechanisms. Think robotics, for instance.)

Note: The equivalent description in 2D would be using a vector in R^7: cartesian position of center of mass, a unit complex number to describe the angle, cartesian components of the velocity of the center of mass, and angular velocity. Does not make so much sense in 2D though, as the configuration space can be covered singularity-free in a single chart.

If there is interest, I may expand on this sometime ... involves rummaging my psychological attic, plenty of cobwebs there :)


WHD: IIRC, OpenGL uses something it calls quaternions to represent points in three space: (i,j,k,s) where s (corresponding to q0 in the above) is a scale factor, i.e., (i,j,k,s) represents the same point as (i/s, j/s, k/s, 1). Apparently this makes doing many kinds of transformation easier.


AM See also the Math package by Martin Russell - Mathematically oriented extensions


Category Mathematics