]>
Book Contents Previous Section 9.63 Polynomial Next Section 9.65 RadixExpansion Book Index

## 9.64 Quaternion

The domain constructor Quaternion implements quaternions over commutative rings. For information on related topics see ComplexXmpPage and OctonionXmpPage . You can also issue the system command )show Quaternion to display the full list of operations defined by Quaternion.

The basic operation for creating quaternions is quatern quatern Quaternion. This is a quaternion over the rational numbers.

q := quatern(2/11,-8,3/4,1)

2 11-8 i+3 4 j+k

Type: Quaternion Fraction Integer

The four arguments are the real part, the i imaginary part, the j imaginary part, and the k imaginary part, respectively.

[real q, imagI q, imagJ q, imagK q]

[2 11,-8,3 4,1]

Type: List Fraction Integer

Because q is over the rationals (and nonzero), you can invert it.

inv q

352 126993+15488 126993 i-484 42331 j-1936 126993 k

Type: Quaternion Fraction Integer

The usual arithmetic (ring) operations are available

q**6

-2029490709319345 7256313856-48251690851 1288408 i+144755072553 41229056 j+48251690851 10307264 k

Type: Quaternion Fraction Integer
r := quatern(-2,3,23/9,-89); q + r

-20 11-5 i+119 36 j-88 k

Type: Quaternion Fraction Integer

In general, multiplication is not commutative.

q * r - r * q

-2495 18 i-1418 j-817 18 k

Type: Quaternion Fraction Integer

There are no predefined constants for the imaginary i, j, and k parts, but you can easily define them.

i:=quatern(0,1,0,0); j:=quatern(0,0,1,0); k:=quatern(0,0,0,1)

k

Type: Quaternion Integer

These satisfy the normal identities.

[i*i, j*j, k*k, i*j, j*k, k*i, q*i]

[-1,-1,-1,k,i,j,8+2 11 i+j-3 4 k]

Type: List Quaternion Fraction Integer

The norm is the quaternion times its conjugate.

norm q

126993 1936

Type: Fraction Integer
conjugate q

2 11+8 i-3 4 j-k

Type: Quaternion Fraction Integer
q * %

126993 1936

Type: Quaternion Fraction Integer
Book Contents Previous Section 9.63 Polynomial Next Section 9.65 RadixExpansion Book Index