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;
```
K
```> with( Quaternions ):
> J*I;
```
-K

As this example shows, multiplication no longer assumes commutativitity.

Operators

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( % );
```
.3000000000+.5000000000*I-.7000000000*J+.1000000000*K

Types

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
`+`                 `*`                 `^`
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.

Plotting

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.

References

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.