aboutsummaryrefslogtreecommitdiff
path: root/src/hyper/pages/QUAT.ht
blob: eaae2c84ae13c0179ce6326f1190a548251211d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
% Copyright The Numerical Algorithms Group Limited 1992-94. All rights reserved.
% !! DO NOT MODIFY THIS FILE BY HAND !! Created by ht.awk.
\newcommand{\QuaternionXmpTitle}{Quaternion}
\newcommand{\QuaternionXmpNumber}{9.64}
%
% =====================================================================
\begin{page}{QuaternionXmpPage}{9.64 Quaternion}
% =====================================================================
\beginscroll
The domain constructor \spadtype{Quaternion} implements quaternions over
commutative rings.
For information on related topics, see
%\menuxmpref{CliffordAlgebra}
\downlink{`Complex'}{ComplexXmpPage}\ignore{Complex} and
\downlink{`Octonion'}{OctonionXmpPage}\ignore{Octonion}.
You can also issue the system command
\spadcmd{)show Quaternion}
to display the full list of operations defined by
\spadtype{Quaternion}.

\xtc{
The basic operation for creating quaternions is
\spadfunFrom{quatern}{Quaternion}.
This is a quaternion over the rational numbers.
}{
\spadpaste{q := quatern(2/11,-8,3/4,1) \bound{q}}
}
\xtc{
The four arguments are the real part, the \spad{i} imaginary part, the
\spad{j} imaginary part, and the \spad{k} imaginary part, respectively.
}{
\spadpaste{[real q, imagI q, imagJ q, imagK q] \free{q}}
}
\xtc{
Because \spad{q} is over the rationals (and nonzero), you can invert it.
}{
\spadpaste{inv q \free{q}}
}
\xtc{
The usual arithmetic (ring) operations are available
}{
\spadpaste{q**6 \free{q}}
}
\xtc{
}{
\spadpaste{r := quatern(-2,3,23/9,-89); q + r \bound{r}\free{q}}
}
%
\xtc{
In general, multiplication is not commutative.
}{
\spadpaste{q * r - r * q\free{q r}}
}
\xtc{
There are no predefined constants for the imaginary \spad{i, j},
and \spad{k} parts, but you can easily define them.
}{
\spadpaste{i:=quatern(0,1,0,0); j:=quatern(0,0,1,0); k:=quatern(0,0,0,1) \bound{i j k}}
}
\xtc{
These satisfy the normal identities.
}{
\spadpaste{[i*i, j*j, k*k, i*j, j*k, k*i, q*i] \free{i j k q}}
}
\xtc{
The norm is the quaternion times its conjugate.
}{
\spadpaste{norm q \free{q}}
}
\xtc{
}{
\spadpaste{conjugate q \free{q} \bound{prev}}
}
\xtc{
}{
\spadpaste{q * \% \free{q prev}}
}
\endscroll
\autobuttons
\end{page}
%