aboutsummaryrefslogtreecommitdiff
path: root/src/input/kuipers.input.pamphlet
blob: b9a5847fe7db244da236ea9dde91fc69f119af1b (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
\documentclass{article}
\usepackage{axiom}
\begin{document}
\title{Quaternions and Rotation Sequences}
\author{Timothy Daly}
\maketitle
\begin{abstract}
\end{abstract}
\eject
\tableofcontents
\eject
\section{Rotations in 3-space}
Orthogonal groups are used in Quantum Field Theory. Conway highlights
4 kinds of orthogonal groups. First is the General Orthogonal group
$GO_n$ which is the set of all isometries of n-dimensional Euclidean
space $R^n$ that fix the origin. This would imply rotations and
reflections but not translations.

The determinant of any element in $GO_n$ is $+1$ or $-1$. Reflections
have a determinant of $-1$. The elements of determinant $+1$
(rotations) form a subgroup of index 2, the Special Orthogonal group
$SO_n$. The product of any two reflections forms a rotation so
grouping reflections in pairs generates $SO_n$.

Conway also defines two groups derived from $GO_n$ and $SO_n$. From
$GO_n$ we get the Projective General Orthogonal group. From $SO_n$ we
get the Projective Special Orthogonal group. Annoyingly, he's
introduced these groups without explaining them.  And based their
definition on an undefined $\alpha$.

It is a consequence of the existence of complex numbers that $SO_2$
and $PSO_2$ are commutative; of the existence of quaternions that
$PSO_4$ is equivalent to $PSO_3 \times PSO_3$; and of the existence of
octonions that <img alt=$PSO_8$ has a "triality" automorphism of order 3.

Now we move back to Kuipers, Chapter 3 "Rotations in 3-space"

Rotation matrices are unique. Euler angle rotations are not.
Eigenvalues of rotation matrices are always $+1$ plus a pair of
complex conjugates.  The trace of a square matrix is the sum of the
elements on the diagonal.

The following code are the steps in the tracking example starting on p60.

First we define a rotation around the X axis by a rotation angle $a$.

<<spadcommand>>=
R1:=matrix([[cos a, sin a, 0],[-sin a, cos a, 0],[0, 0, 1]])

@

\begin{verbatim}
        + cos(a)   sin(a)  0+
        |                   |
   (1)  |- sin(a)  cos(a)  0|
        |                   |
        +   0        0     1+

   Type: Matrix Expression Integer
\end{verbatim}

Next we define a rotation around the Y axis by a rotation angle of $b$.

<<spadcommand>>=
R2:=matrix([[cos b, 0, -sin b],[0, 1, 0],[sin b, 0, cos b]])

@

\begin{verbatim}
        +cos(b)  0  - sin(b)+
        |                   |
   (2)  |  0     1     0    |
        |                   |
        +sin(b)  0   cos(b) +

   Type: Matrix Expression Integer
\end{verbatim}

Then we compose them (order is important) to form the single rotation
equivalent to first rotating around $X$, then around the new,
displaced $Y$.

<<spadcommand>>=
R:=R2*R1

@

\begin{verbatim}
        +cos(a)cos(b)  cos(b)sin(a)  - sin(b)+
        |                                    |
   (3)  |  - sin(a)       cos(a)        0    |
        |                                    |
        +cos(a)sin(b)  sin(a)sin(b)   cos(b) +

   Type: Matrix Expression Integer
\end{verbatim}

To find the axis of this single rotation we define the vector $V$

<<spadcommand>>=
V:=matrix([[x1],[y1],[z1]])
@

\begin{verbatim}
        +x1+
        |  |
   (4)  |y1|
        |  |
        +z1+

   Type: Matrix Polynomial Integer
\end{verbatim}

And this is the equation we need to solve. Since we rotate around the
vector $V$ it is unchanged when operated on by the rotation $R$, or in
equation form we get 

<<spadcommand>>=
E:=R*V=V

@

\begin{verbatim}
        +- z1 sin(b) + y1 cos(b)sin(a) + x1 cos(a)cos(b)+  +x1+
        |                                               |  |  |
   (5)  |            - x1 sin(a) + y1 cos(a)            |= |y1|
        |                                               |  |  |
        +   (y1 sin(a) + x1 cos(a))sin(b) + z1 cos(b)   +  +z1+

   Type: Equation Matrix Expression Integer
\end{verbatim}

We can subtract the right hand side from the left hand side thus

<<spadcommand>>=
F:=lhs(E)-rhs(E)

@

\begin{verbatim}
        +- z1 sin(b) + y1 cos(b)sin(a) + x1 cos(a)cos(b) - x1+
        |                                                    |
   (6)  |            - x1 sin(a) + y1 cos(a) - y1            |
        |                                                    |
        +   (y1 sin(a) + x1 cos(a))sin(b) + z1 cos(b) - z1   +

    Type: Matrix Expression Integer
\end{verbatim}

and form the equation setting the result to zero. This has two solutions.
The trivial solution is when $V$ is zero. 
We solve for the nontrivial solution.

<<spadcommand>>=
G:=F=matrix([[0],[0],[0]])

@

\begin{verbatim}
        +- z1 sin(b) + y1 cos(b)sin(a) + x1 cos(a)cos(b) - x1+  +0+
        |                                                    |  | |
   (7)  |            - x1 sin(a) + y1 cos(a) - y1            |= |0|
        |                                                    |  | |
        +   (y1 sin(a) + x1 cos(a))sin(b) + z1 cos(b) - z1   +  +0+

   Type: Equation Matrix Expression Integer
\end{verbatim}


If we pick out the second equation

<<spadcommand>>=
H:=elt(F,2,1)

@

\begin{verbatim}
   (8)  - x1 sin(a) + y1 cos(a) - y1

   Type: Expression Integer
\end{verbatim}

and let x1 = k

<<spadcommand>>=
x1:=k

@

\begin{verbatim}
   (9)  k

   Type: Variable k
\end{verbatim}

and substitute this into the second equation

<<spadcommand>>=
J:=subst(H,'x1=k)

@

\begin{verbatim}
   (10)  - k sin(a) + y1 cos(a) - y1

   Type: Expression Integer
\end{verbatim}

we can solve this equation for y1.

<<spadcommand>>=
L:=solve(J,y1)

@

\begin{verbatim}
               k sin(a)
   (11)  [y1= ----------]
              cos(a) - 1

   Type: List Equation Expression Integer
\end{verbatim}

and we can assign the solution to the variable y1

<<spadcommand>>=
y1:=rhs(first(solve(J,y1)))

@

\begin{verbatim}
          k sin(a)
   (12)  ----------
         cos(a) - 1

   Type: Expression Integer
\end{verbatim}

Now we turn our attention to the third equation

<<spadcommand>>=
H1:=elt(F,3,1)

@

\begin{verbatim}
   (13)  (y1 sin(a) + x1 cos(a))sin(b) + z1 cos(b) - z1

   Type: Expression Integer
\end{verbatim}

and substitute the known values for x1 and y1

<<spadcommand>>=
J1:=subst(H1,['x1=x1, 'y1=y1])

@

\begin{verbatim}
   (14)
                2           2
       (k sin(a)  + k cos(a)  - k cos(a))sin(b) + (z1 cos(a) - z1)cos(b)
     + 
       - z1 cos(a) + z1
  /
     cos(a) - 1

    Type: Expression Integer
\end{verbatim}

and then solve for z1, assigning it to the variable z1


<<spadcommand>>=
z1:=simplify(rhs(first(solve(J1,z1))))

@

\begin{verbatim}
          k sin(b)
   (15)  ----------
         cos(b) - 1

   Type: Expression Integer
\end{verbatim}

So the axis of rotation is

<<spadcommand>>=
[x1,y1,z1]

@

\begin{verbatim}
             k sin(a)   k sin(b)
   (16)  [k,----------,----------]
            cos(a) - 1 cos(b) - 1

   Type: List Expression Integer
\end{verbatim}

We can choose a specific value of $k = -1$ so that $y1$ becomes

<<spadcommand>>=
y1:=eval(y1,[k=-1])

@

\begin{verbatim}
             sin(a)
   (17)  - ----------
           cos(a) - 1

   Type: Expression Integer
\end{verbatim}

and $z1$ becomes

<<spadcommand>>=
z1:=eval(z1,[k=-1])

@

\begin{verbatim}
             sin(b)
   (18)  - ----------
           cos(b) - 1

   Type: Expression Integer
\end{verbatim}

So the axis of rotation is

<<spadcommand>>=
[x1,y1,z1]

@

\begin{verbatim}
                sin(a)       sin(b)
   (19)  [k,- ----------,- ----------]
              cos(a) - 1   cos(b) - 1

   Type: List Expression Integer
\end{verbatim}

We need the trace of the matrix which is only defined for square matrices.
So we create a new version of the R matrix as a square matrix $RSQ$

<<spadcommand>>=
RSQ:SQMATRIX(3,EXPR(INT)):=R

@

\begin{verbatim}
         +cos(a)cos(b)  cos(b)sin(a)  - sin(b)+
         |                                    |
   (20)  |  - sin(a)       cos(a)        0    |
         |                                    |
         +cos(a)sin(b)  sin(a)sin(b)   cos(b) +

   Type: SquareMatrix(3,Expression Integer)
\end{verbatim}

Now we compute the trace

<<spadcommand>>=
TR:=trace(RSQ)

@

\begin{verbatim}
   (21)  (cos(a) + 1)cos(b) + cos(a)

   Type: Expression Integer
\end{verbatim}

and we can obtain the angle of rotation by equating the trace to 1-2*cos(c)

<<spadcommand>>=
TREQ:=TR=1+2*cos(c)

@

\begin{verbatim}
   (22)  (cos(a) + 1)cos(b) + cos(a)= 2cos(c) + 1

   Type: Equation Expression Integer
\end{verbatim}

which we can solve for c

<<spadcommand>>=
c:=rhs(first(solve(TREQ,c)))

@

\begin{verbatim}
              (cos(a) + 1)cos(b) + cos(a) - 1
   (23)  acos(-------------------------------)
                             2

   Type: Expression Integer
\end{verbatim}

assuming $k=-1$, heading $a=\pi/6$, and elevation $b=\pi/3$ we can
compute numeric values for the axis of rotation thus. First a numeric
$x1$

<<spadcommand>>=
x1v:=eval(x1,k=-1)

@

\begin{verbatim}
   (24)  - 1

   Type: Polynomial Integer
\end{verbatim}

then a numeric y1

<<spadcommand>>=
y1v:=numeric(eval(y1,[a=%pi/6]))

@

\begin{verbatim}
   (25)  3.7320508075 688772936

   Type: Float
\end{verbatim}

then a numeric z1

<<spadcommand>>=
z1v:=numeric(eval(z1,[k=-1,b=%pi/3]))

@

\begin{verbatim}
   (26)  1.7320508075 688772935

   Type: Float
\end{verbatim}

giving us the vector for the axis of rotation

<<spadcommand>>=
[x1v, y1v, z1v]

@

\begin{verbatim}
   (27)  [- 1.0,3.7320508075 688772936,1.7320508075 688772935]

   Type: List Polynomial Float
\end{verbatim}

with a rotation angle (in radians) given by

<<spadcommand>>=
c1v:=numeric(eval(c,[a=%pi/6,b=%pi/3]))

@

\begin{verbatim}
   (28)  1.1598041770 494147762

   Type: Float
\end{verbatim}

in degrees this is 

<<spadcommand>>=
c1v*180/%pi

@

\begin{verbatim}
   (29)  66.4518844065 75160021

   Type: Float
\end{verbatim}

We can evaluate the combined rotation matrix under our assumed values

<<spadcommand>>=
rv:=eval(R,[a=%pi/6,b=%pi/3])

@

\begin{verbatim}
         + +-+           +-++
         |\|3    1      \|3 |
         |----   -    - ----|
         |  4    4        2 |
         |                  |
         |       +-+        |
   (30)  |  1   \|3         |
         |- -   ----    0   |
         |  2     2         |
         |                  |
         |       +-+        |
         | 3    \|3     1   |
         | -    ----    -   |
         + 4      4     2   +

   Type: Matrix Expression Integer
\end{verbatim}
<<*>>=
<<spadcommand>>
@
\eject
\begin{thebibliography}{99}
\bibitem{1} nothing
\end{thebibliography}
\end{document}