aboutsummaryrefslogtreecommitdiff
path: root/src/input/quat.input.pamphlet
blob: 93c35feec0d266a916350efef036856f4e9f3bac (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
\documentclass{article}
\usepackage{axiom}
\begin{document}
\title{\$SPAD/src/input quat.input}
\author{The Axiom Team}
\maketitle
\begin{abstract}
\end{abstract}
\eject
\tableofcontents
\eject
\section{License}
<<license>>=
--Copyright The Numerical Algorithms Group Limited 1991.
@
<<*>>=
<<license>>

-- This file demonstrates some operations with quaternions.
 
)clear all
 
-- The basic function for creating quaternions is "quatern". This is
-- a quaternion over the rational numbers.
q := quatern(2/11,-8,3/4,1)
 
-- The four arguments are the real part, the i imaginary part, the
-- j imaginary part and the k imaginary part, respectively. These are
-- extracted with the following functions.
 
real q
imagI q
imagJ q
imagK q
 
-- Because q is over the rationals (and nonzero), you can invert it ...
inv q
 
-- in addition to the normal arithmetic (ring) operations.
q**6
r := quatern(-2,3,23/9,-89)
q + r
q - r
 
-- In general, multiplication is not commutative.
q * r
r * q
 
-- There are no predefined constants for the imaginary i, j and k but
-- you can easily define them.
 
i := quatern(0,1,0,0)
j := quatern(0,0,1,0)
k := quatern(0,0,0,1)
 
i*i
j*j
k*k
i*j
j*k
k*i
q * i
 
-- The norm is the quaternion times its conjugate
norm q
conjugate q
q * %
@
\eject
\begin{thebibliography}{99}
\bibitem{1} nothing
\end{thebibliography}
\end{document}