Welcome to the Quaternions 1.0 for Maple Web Site.


A Quick Introduction

The Quaternions package allows the user to construct and work with quaternions in Maple as naturally as you can work with complex numbers. This requires significant changes to the Maple infrastructure, as Maple assumes that * is commutative. Once you have loaded the Quaternions package, the assumption of the commutativity of * is removed. After this, many other Maple functions have been modified to recognize quaternions.

What is a quaternion? real sets. The operators union and intersect, to name a few, are overloaded to accept fuzzy sets as well as classic Maple sets. For example,

> with( Quaternions ):
> I*J;
> with( Quaternions ):
> J*I;

As this example shows, multiplication no longer assumes commutativitity.


The five operators +, -, *, /, and ^ have been overloaded to recognize quaternions and to operate accordingly

> with( Quaternions ):
> (3 + 4*I)*(4 - 5*J);
12 + 16 I - 15 J - 20 K
> with( Quaternions ):
> (4 - 5*J)*(3 + 4*I);
12 + 16 I - 15 J + 20 K

Quaternions and Complex Numbers

The absolute value of the quaternion q = a + b*I + c*J + d*K is abs(q) = sqrt( a^2 + b^2 + c^2 + d^2 ). The real part of the quaternion q, like the definition of the real part of a complex number, is Re(q) = a. The imaginary part is defined as the complement to the real part: Im(q) = b*I + c*J + d*K. This differs from the corresponding complex variable definition. Fortunately, this definition simplifies many standard definitions:

    exp(q) = exp(Re(q))*(cos(abs(Im(q))) + Im(q)/abs(Im(q)) * sin(abs(Im(q)))).

Note that for a quaternion of the form q = a + b*I, this is equivalent to the standard definition of the complex exponential function.

The conjugate of a quaternion negates the coefficients of the imaginary components and the property q*conjugate(q) = abs(q)^2 continues to hold. The argument is defined such that q = abs(q)*exp(Im(q)/abs(Im(q)) * argument(q)).

Mathematical Functions

Given any purely-imaginary quaternion u, the space R + uR forms a field, and therefore all functions with series expansions containing only real coefficients are well defined, mapping r + u into R + uR. For exmaple,

> sin( 0.3+0.5*I-0.7*J+0.1*K );
0.4134420339 + 0.5396562478 I - 0.7555187469 J + 0.1079312496 K
> arcsin( % );


Any value which is a sum of extended numeric values multiplied by the basis elements {1, I, J, K} is recognized as a quaternion. In addition to this type, the following types:

      nonreal             imaginary
      embedded_axis       embedded_imaginary  embedded_real
      undefined           finite              infinity
      `+`                 `*`                 `^`
      radical             sqrt
      atomic              function            anyfunc

have been overloaded to ensure that they recognize the corresponding equivalent quaternion structures. For example, a quaternion is of type finite if each of the four components is finite. Similarly, a quaternion is of type embedded_real if it is either of type extended numeric or a quaternion with an imaginary component with zero magnitude.


A number of plotting routines are included with the package allowing the user to plot quaterions.

Supporting Documentation

The Quaternions package comes with a worksheet which covers the theory of quaternions in significant detail. Additionally, worksheets describing the use of quaternions with rotation sequences and fractals are also included.


All the references used in the construction of the package are provided, though most useful was a collection of unpublished class notes by Dr. J.A.R. Holbrook from the University of Guelph. Dr. Jack B. Kuipers text Quaternions and Rotation Sequences was an excellent reference for the relationship between quaternions and rotation sequences.

About the Author

Douglas Wilhelm Harder was a developer in the Math Group at Wateloo Maple Inc. (Maplesoft Inc.) for almost five years. He has worked on many different parts of the Maple library and is the author of a number of packages and routines made available with Maple 6 through Maple 8. His largest single package is the comprehensive Units package. Today he works as a lectuer at the University of Waterloo in the Department of Electrical and Computer Engineering.

Purchasing the Quaternions Package

The Quaternions package is available through Maplesoft at their Third Party Products site. Technical support for this package is available by emailing the author at dwharder@uwater1**.ca (making the appropriate substitution of loo for 1**).

Questions will be summarized in an FAQ.

This page is Copyright (c) 2004 by Douglas Wilhelm Harder. All rights reserved.