Kodama's home / tips.

Quaternion/Octonion class for ruby.

Download: quaternion.rb, octonion.rb.
See also Ruby and Ruby Application Archives.

Quaternion or Hamilton number

Typical Hamilton number q is of the form q = a + b i + c j + d k. This is known as Quaternion. Bases i j k behaves as follows.
i^2 = j^2 = k^2 = -1,
i j = k, j k = i, k i = j,
j i = -k, k j = -i, i k = -j.
Quaternion numbers are not Commutative.

We can think Quaternions as 4-D space over Real numbers, and 2-D space over Complex numbers as q = (a + b i) + (c + d i)j.
Quaternion is used to describe rotation in 3-D space. Quaternion with no real part v = b i + c j + d k is called "vector quaternion", and 3-D space. For a vector v and a Quaternion q = |q|(cos t/2 + u sin t/2), q v q^(-1) is a vector v t-rotated along u.

D4 lattice is lattice points of Quaternion q = a + b i + c j + d k as follows.
(1) a,b,c,d are all integer, or
(2) a,b,c,d are all half-integer.
D4 is sub-ring of Quaternion with GCD. (Ring means a space with +, - and *.)

Octonion or Cayley number

Typical Cayley number o is of the form o = a + b i1 + c i2 + d i3 + e i4 + f i5 + g i6 + h i7. This is known as Octonion. Each of the Cayley triples (123) (145) (176) (246) (257) (347) (365) behaves like the Quaternions (i j k).
Octonion numbers are not Associative and not Commutative.

Octonion is 8-D space over Real number, 4-D space over Complex number, and 2-D space over Quaternion number as follows.
o=a + b i1 + c i2 + d i3 + e i4 + f i5 + g i6 + h i7
=a + b i + (c + d i) i2 + (e + f i) i4 + (g - h i)i6
=(a + b i1 + c i2 + d i3) + (e + f i1+ g i2 + h i3)i4.
Octonion is used to describe rotation in 7-D space.

Kodama's home / tips.