This is documentation for Mathematica 3, which was
based on an earlier version of the Wolfram Language.
 Algebra`Quaternions` This package implements Hamilton's quaternion algebra. Quaternions have the form where , , , and are real numbers. The symbols , , and are multiplied according to the rules . Quaternions are an extension of the complex numbers, and work much the same except that their multiplication is not commutative. For instance, . Because of the similarities between quaternions and complex numbers, this package imitates Mathematica's treatment of complex numbers in many ways. To provide a clear distinction between quaternions and complex numbers, all quaternions should be entered using the form Quaternion[ a,b,c,d] where , , , and are real numbers. Only limited support is offered to the symbolic form a +Ib+Jc+Kd. Defining, testing, and transforming quaternions. This loads the package. In[1]:= <True that checks to see if a number is prime with respect to the Gaussian integers. This package extends PrimeQ further to check if a number is prime with respect to the quaternions. Lagrange proved that every integer can be expressed as a sum of squares of at most four integers. Therefore, given an integer , there is a quaternion with integer components such that q **Conjugate[q]==n. So no integer is prime with respect to the quaternions. In fact, a quaternion integer is prime if and only if its norm is prime in the usual sense. An extension of PrimeQ. 19 is a prime with respect to the Gaussian integers. In[25]:= PrimeQ[19, GaussianIntegers->True] Out[25]= It is not a prime with respect to the quaternions. It can be factored into Quaternion[1,4,1,1] and Quaternion[1,-4,-1,-1]. In[26]:= PrimeQ[19, Quaternions->True] Out[26]= Quaternion[1,3,0,1] is a prime quaternion. In[27]:= PrimeQ[Quaternion[1,3,0,1], Quaternions->True] Out[27]=