
% Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
% All rights reserved.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions are
% met:
%
%     - Redistributions of source code must retain the above copyright
%       notice, this list of conditions and the following disclaimer.
%
%     - Redistributions in binary form must reproduce the above copyright
%       notice, this list of conditions and the following disclaimer in
%       the documentation and/or other materials provided with the
%       distribution.
%
%     - Neither the name of The Numerical ALgorithms Group Ltd. nor the
%       names of its contributors may be used to endorse or promote products
%       derived from this software without specific prior written permission.
%
% THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
% IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
% TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
% PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
% OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
% EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
% PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES-- LOSS OF USE, DATA, OR
% PROFITS-- OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
% LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
% NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
% SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.



The Octonions, also called the Cayley-Dickson algebra, defined over a
commutative ring are an eight-dimensional non-associative algebra.
Their construction from quaternions is similar to the construction
of quaternions from complex numbers (see \xmpref{Quaternion}).
\exptypeindex{Quaternion}
%
\xtc{
As \spadtype{Octonion} creates an eight-dimensional algebra, you have to
give eight components to construct an octonion.
}{
\spadcommand{oci1 := octon(1,2,3,4,5,6,7,8) \bound{oci1}}
}
\xtc{
}{
\spadcommand{oci2 := octon(7,2,3,-4,5,6,-7,0) \bound{oci2}}
}
%
%
\xtc{
Or you can use two quaternions to create an octonion.
}{
\spadcommand{oci3 := octon(quatern(-7,-12,3,-10), quatern(5,6,9,0)) \bound{oci3}}
}
%
%
\xtc{
You can easily demonstrate the non-associativity of multiplication.
}{
\spadcommand{(oci1 * oci2) * oci3 - oci1 * (oci2 * oci3) \free{oci1 oci2 oci3}}
}
%
As with the quaternions, we have a real part, the imaginary
parts \spad{i}, \spad{j}, \spad{k}, and four
additional imaginary parts \spad{E}, \spad{I}, \spad{J} and \spad{K}.
These parts correspond to the canonical basis
\spad{(1,i,j,k,E,I,J,K)}.
\xtc{
For each basis element there is a component operation to extract
the coefficient of the basis element for a given octonion.
%\spadfunFrom{real}{Octonion},
%\spadfunFrom{imagi}{Octonion},
%\spadfunFrom{imagj}{Octonion},
%\spadfunFrom{imagk}{Octonion},
%\spadfunFrom{imagE}{Octonion},
%\spadfunFrom{imagI}{Octonion},
%\spadfunFrom{imagJ}{Octonion}, and
%\spadfunFrom{imagK}{Octonion}.
}{
\spadcommand{[real oci1, imagi oci1, imagj oci1, imagk oci1, imagE oci1, imagI oci1, imagJ oci1, imagK oci1] \free{oci1}}
}
%
A basis with respect to the
quaternions is given by \spad{(1,E)}.
However, you might ask, what then are the commuting rules?
To answer this, we create some generic elements.
%
\xtc{
We do this in \Language{}
by simply changing the ground ring from \spadtype{Integer} to
\spadtype{Polynomial Integer}.
}{
\spadcommand{q : Quaternion Polynomial Integer := quatern(q1, qi, qj, qk) \bound{q}}
}
\xtc{
}{
\spadcommand{E : Octonion Polynomial Integer:= octon(0,0,0,0,1,0,0,0) \bound{E}}
}
%
\xtc{
Note that quaternions are automatically converted to octonions in the
obvious way.
}{
\spadcommand{q * E \free{q E}}
}
\xtc{
}{
\spadcommand{E * q \free{E q}}
}
\xtc{
}{
\spadcommand{q * 1\$(Octonion Polynomial Integer) \free{q}}
}
\xtc{
}{
\spadcommand{1\$(Octonion Polynomial Integer) * q \free{q}}
}
\xtc{
Finally, we check that the \spadfunFrom{norm}{Octonion},
defined as the sum of the squares of the coefficients,
is a multiplicative map.
}{
\spadcommand{o : Octonion Polynomial Integer := octon(o1, oi, oj, ok, oE, oI, oJ, oK) \bound{o}}
}
\xtc{
}{
\spadcommand{norm o \free{o}}
}
\xtc{
}{
\spadcommand{p : Octonion Polynomial Integer := octon(p1, pi, pj, pk, pE, pI, pJ, pK) \bound{p}}
}
\xtc{
Since the result is \spad{0}, the norm is multiplicative.
}{
\spadcommand{norm(o*p)-norm(o)*norm(p)\free{o p} }
}
\showBlurb{Octonion}
