  A common problem in physics and engineering is determination of the
orientation of an object given its angular velocity. When the direction of the
angular velocity changes in time, this is a nontrivial problem involving
coupled differential equations. Several possible approaches are examined, along
with various improvements over previous efforts. These are then evaluated
numerically by comparison to a complicated but analytically known rotation that
is motivated by the important astrophysical problem of precessing black-hole
binaries. It is shown that a straightforward solution directly using
quaternions is most efficient and accurate, and that the norm of the quaternion
is irrelevant. Integration of the generator of the rotation can also be made
roughly as efficient as integration of the rotation. Both methods will
typically be twice as efficient as naive vector- or matrix-based methods.
Implementation by means of standard general-purpose numerical integrators is
stable and efficient, so that such problems can be readily solved as part of a
larger system of differential equations. Possible generalization to integration
in other Lie groups is also discussed.
