Ref:
http://en.wikipedia.org/wiki/Cayley%E2%80%93Dickson_construction
"The Cayley–Dickson construction, named after Arthur Cayley and Leonard Eugene Dickson, produces a sequence of algebras over the field of real numbers, each with twice the dimension of the previous one. The algebras produced by this process are known as Cayley–Dickson algebras; since they extend the complex numbers, ... "
complex numbers, quaternions, octonions, sedenions, ...
http://en.wikipedia.org/wiki/Hypercomplex_number
spad
)abbrev domain CALEY CaleyDickson
CaleyDickson(C:CommutativeRing,gen:Symbol,gamma:C):ComplexCategory(C) with
scalar:List % -> %
== add
Rep == DirectProduct(2,C)
rep(x:%):Rep == x pretend Rep
per(x:Rep):% == x pretend %
pair(x:C,y:C):Rep == directProduct vector [x,y]
complex(x:C,y:C):% == per pair(x,y)
real(x:%):C == rep(x).1
imag(x:%):C == rep(x).2
0:% == complex(0,0)
zero?(x:%):Boolean == zero? rep(x)
1:% == per pair(1,0)
one?(x:%):Boolean == one? real x and zero? imag x
if C has conjugate:C->C then
-- In general we need conjugate
(x:% * y:%):% ==
complex(real x * real y - gamma*conjugate imag y * imag x,
imag y * real x + imag x * conjugate real y)
conjugate(x:%):% == complex(conjugate(real x), -imag x)
else
-- If not complex then conjugate is identity
(x:% * y:%):% ==
complex(real x * real y - gamma*imag y * imag x,
imag y * real x + imag x * real y)
conjugate(x:%):% == complex(real x, -imag x)
norm(x:%):C == retract(conjugate(x)*x)
if C has Field then
inv(x:%):% == per(inv(real(conjugate x * x))$C * rep conjugate x)
(x:% / y:%):% == x * inv(y)
if C has rank:()->PositiveInteger then
rank():PositiveInteger == 2*rank()$C
else
rank():PositiveInteger == 2
if C has basis:()->Vector C then
basis():Vector % ==
concat([complex(i,0) for i in entries basis()$C],
[complex(0,i) for i in entries basis()$C])
else
basis():Vector % == [1,imaginary()]
if C has scalar:List C -> C then
scalar(x:List %):% ==
h:Integer := divide(#x,2).quotient
complex(scalar([retract(x.i)@C for i in 1..h]),scalar([retract(x.i)@C for i in h+1..#x]))
else
scalar(x:List %):% == complex(retract x.1,retract x.2)
coerce(x:%):OutputForm ==
outr:=real(x)::OutputForm
imag x = 0 => return outr
outi := hconcat(imag(x)::OutputForm, gen::OutputForm)
if imag x = 1 then
outi := gen::OutputForm
if imag x = -1 then
outi := -(gen::OutputForm)
if C has imaginary:()->C then
if imag x = -imaginary()$C then
outi := -hconcat(imaginary()$C::OutputForm,gen::OutputForm)
real x = 0 => return outi
return outr + outi
--
-- Many other funtctions are inherited from ComplexCategory
--
-- To Do:
-- 1) Check which other functions are still correct for higher-order algebras!
--
-- re-defined these only to save function calls
(x:% + y:%):% == per(rep x + rep y)
(x:% = y:%):Boolean == rep x = rep y
spad
Compiling FriCAS source code from file
/var/zope2/var/LatexWiki/442641077606971384-25px001.spad using
old system compiler.
CALEY abbreviates domain CaleyDickson
------------------------------------------------------------------------
initializing NRLIB CALEY for CaleyDickson
compiling into NRLIB CALEY
****** Domain: C already in scope
compiling local rep : $ -> DirectProduct(2,C)
CALEY;rep is replaced by x
Time: 0.36 SEC.
compiling local per : DirectProduct(2,C) -> $
CALEY;per is replaced by x
Time: 0 SEC.
compiling local pair : (C,C) -> DirectProduct(2,C)
Time: 0.02 SEC.
compiling exported complex : (C,C) -> $
Time: 0 SEC.
compiling exported real : $ -> C
Time: 0 SEC.
compiling exported imag : $ -> C
Time: 0.01 SEC.
compiling exported Zero : () -> $
Time: 0 SEC.
compiling exported zero? : $ -> Boolean
Time: 0 SEC.
compiling exported One : () -> $
Time: 0 SEC.
compiling exported one? : $ -> Boolean
Time: 0.01 SEC.
augmenting C: (SIGNATURE C conjugate (C C))
compiling exported * : ($,$) -> $
Time: 0.01 SEC.
compiling exported conjugate : $ -> $
Time: 0 SEC.
compiling exported * : ($,$) -> $
Time: 0.01 SEC.
compiling exported conjugate : $ -> $
Time: 0 SEC.
compiling exported norm : $ -> C
Time: 0.03 SEC.
****** Domain: C already in scope
augmenting C: (Field)
compiling exported inv : $ -> $
Time: 0 SEC.
compiling exported / : ($,$) -> $
Time: 0 SEC.
augmenting C: (SIGNATURE C rank ((PositiveInteger)))
compiling exported rank : () -> PositiveInteger
Time: 0 SEC.
compiling exported rank : () -> PositiveInteger
CALEY;rank;Pi;19 is replaced by 2
Time: 0 SEC.
augmenting C: (SIGNATURE C basis ((Vector C)))
compiling exported basis : () -> Vector $
Time: 0.04 SEC.
compiling exported basis : () -> Vector $
Time: 0 SEC.
augmenting C: (SIGNATURE C scalar (C (List C)))
compiling exported scalar : List $ -> $
Time: 0.05 SEC.
compiling exported scalar : List $ -> $
Time: 0.01 SEC.
compiling exported coerce : $ -> OutputForm
augmenting C: (SIGNATURE C imaginary (C))
Time: 0.02 SEC.
compiling exported + : ($,$) -> $
Time: 0 SEC.
compiling exported = : ($,$) -> Boolean
Time: 0 SEC.
****** Domain: C already in scope
augmenting C: (EuclideanDomain)
****** Domain: C already in scope
augmenting C: (PolynomialFactorizationExplicit)
****** Domain: C already in scope
augmenting C: (RadicalCategory)
****** Domain: C already in scope
augmenting C: (TranscendentalFunctionCategory)
****** Domain: C already in scope
augmenting C: (RealNumberSystem)
****** Domain: C already in scope
augmenting C: (TranscendentalFunctionCategory)
****** Domain: C already in scope
augmenting C: (Comparable)
****** Domain: C already in scope
augmenting C: (ConvertibleTo (InputForm))
****** Domain: C already in scope
augmenting C: (ConvertibleTo (Pattern (Float)))
****** Domain: C already in scope
augmenting C: (ConvertibleTo (Pattern (Integer)))
****** Domain: C already in scope
augmenting C: (DifferentialRing)
****** Domain: C already in scope
augmenting C: (Eltable C C)
****** Domain: C already in scope
augmenting C: (EuclideanDomain)
****** Domain: C already in scope
augmenting C: (Evalable C)
****** Domain: C already in scope
augmenting C: (Field)
****** Domain: C already in scope
augmenting C: (Finite)
****** Domain: C already in scope
augmenting C: (FiniteFieldCategory)
****** Domain: C already in scope
augmenting C: (InnerEvalable (Symbol) C)
****** Domain: C already in scope
augmenting C: (IntegerNumberSystem)
****** Domain: C already in scope
augmenting C: (IntegralDomain)
****** Domain: C already in scope
augmenting C: (LinearlyExplicitRingOver (Integer))
****** Domain: C already in scope
augmenting C: (PartialDifferentialRing (Symbol))
****** Domain: C already in scope
augmenting C: (PatternMatchable (Float))
****** Domain: C already in scope
augmenting C: (PatternMatchable (Integer))
****** Domain: C already in scope
augmenting C: (RealConstant)
****** Domain: C already in scope
augmenting C: (RealNumberSystem)
****** Domain: C already in scope
augmenting C: (RetractableTo (Fraction (Integer)))
****** Domain: C already in scope
augmenting C: (RetractableTo (Integer))
****** Domain: C already in scope
augmenting C: (TranscendentalFunctionCategory)
(time taken in buildFunctor: 2290)
;;; *** |CaleyDickson| REDEFINED
;;; *** |CaleyDickson| REDEFINED
Time: 2.46 SEC.
Cumulative Statistics for Constructor CaleyDickson
Time: 3.03 seconds
finalizing NRLIB CALEY
Processing CaleyDickson for Browser database:
--->-->CaleyDickson((scalar (% (List %)))): Not documented!!!!
--->-->CaleyDickson(constructor): Not documented!!!!
--->-->CaleyDickson(): Missing Description
; compiling file "/var/zope2/var/LatexWiki/CALEY.NRLIB/CALEY.lsp" (written 18 APR 2011 07:51:08 PM):
; /var/zope2/var/LatexWiki/CALEY.NRLIB/CALEY.fasl written
; compilation finished in 0:00:00.736
------------------------------------------------------------------------
CaleyDickson is now explicitly exposed in frame initial
CaleyDickson will be automatically loaded when needed from
/var/zope2/var/LatexWiki/CALEY.NRLIB/CALEY
>> System error:
The bounding indices 163 and 162 are bad for a sequence of length 162.
See also:
The ANSI Standard, Glossary entry for "bounding index designator"
The ANSI Standard, writeup for Issue SUBSEQ-OUT-OF-BOUNDS:IS-AN-ERROR
Test
axiom
R := Expression Integer
Type: Type
Complex Numbers
axiom
C := CaleyDickson(R,'i,1)
Type: Type
axiom
rank()$C
axiom
Ce:ILIST(C,0) := construct entries basis()$C
Type: IndexedList
?(CaleyDickson
?(Expression(Integer),
i,
1),
0)
axiom
matrix [[Ce.i * Ce.j for j in 0..#Ce-1] for i in 0..#Ce-1]
Type: Matrix(CaleyDickson
?(Expression(Integer),
i,
1))
axiom
--
-- compare
--
Cg:ILIST(Complex R,0) := construct map(x+-> complex(x.1,x.2),
1$SquareMatrix(2,FRAC INT)::List List FRAC INT)
Type: IndexedList
?(Complex(Expression(Integer)),
0)
axiom
matrix [[Cg.i * Cg.j for j in 0..#Cg-1] for i in 0..#Cg-1]
Type: Matrix(Complex(Expression(Integer)))
axiom
-- normed?
c1:C := scalar [subscript('c1,[i]) for i in 1..2]
Type: CaleyDickson
?(Expression(Integer),
i,
1)
axiom
c2:C := scalar [subscript('c2,[i]) for i in 1..2]
Type: CaleyDickson
?(Expression(Integer),
i,
1)
axiom
c3:C := scalar [subscript('c3,[i]) for i in 1..8]
Type: CaleyDickson
?(Expression(Integer),
i,
1)
axiom
-- Normed?
test(norm(c1*c2)=norm(c1)*norm(c2))
Type: Boolean
axiom
-- Commutative?
test( c1 * c2 = c2 * c1 )
Type: Boolean
axiom
-- Associative?
test((c1 * c2) * c3 = c1 * (c2 * c3))
Type: Boolean
Quaternions
axiom
Q := CaleyDickson(C,'j,1)
Type: Type
axiom
rank()$Q
axiom
Qe:ILIST(Q,0) := construct entries basis()$Q
Type: IndexedList
?(CaleyDickson
?(CaleyDickson
?(Expression(Integer),
i,
1),
j,
1),
0)
axiom
matrix [[Qe.i * Qe.j for j in 0..#Qe-1] for i in 0..#Qe-1]
Type: Matrix(CaleyDickson
?(CaleyDickson
?(Expression(Integer),
i,
1),
j,
1))
axiom
--
-- compare
--
Qg:ILIST(Quaternion R,0) := construct map(x+-> quatern(x.1,x.2,x.3,x.4),
1$SquareMatrix(4,FRAC INT)::List List FRAC INT)
Type: IndexedList
?(Quaternion(Expression(Integer)),
0)
axiom
matrix [[Qg.i * Qg.j for j in 0..#Qg-1] for i in 0..#Qg-1]
Type: Matrix(Quaternion(Expression(Integer)))
axiom
q1:Q := scalar [subscript('q1,[i]) for i in 1..4]
Type: CaleyDickson
?(CaleyDickson
?(Expression(Integer),
i,
1),
j,
1)
axiom
q2:Q := scalar [subscript('q2,[i]) for i in 1..4]
Type: CaleyDickson
?(CaleyDickson
?(Expression(Integer),
i,
1),
j,
1)
axiom
q3:Q := scalar [subscript('q3,[i]) for i in 1..8]
Type: CaleyDickson
?(CaleyDickson
?(Expression(Integer),
i,
1),
j,
1)
axiom
-- Normed?
test( norm(q1*q2) = norm(q1)*norm(q2))
Type: Boolean
axiom
-- Commutative?
test( q1 * q2 = q2 * q1 )
Type: Boolean
axiom
-- Associative?
test((q1 * q2) * q3 = q1 * (q2 * q3))
Type: Boolean
Octonions
Ref: http://en.wikipedia.org/wiki/Octonion
axiom
O:=CaleyDickson(Q,'k,1)
Type: Type
axiom
rank()$O
axiom
Oe:ILIST(O,0) := construct entries basis()$O
Type: IndexedList
?(CaleyDickson
?(CaleyDickson
?(CaleyDickson
?(Expression(Integer),
i,
1),
j,
1),
k,
1),
0)
axiom
matrix [[Oe.i * Oe.j for j in 0..#Oe-1] for i in 0..#Oe-1]
Type: Matrix(CaleyDickson
?(CaleyDickson
?(CaleyDickson
?(Expression(Integer),
i,
1),
j,
1),
k,
1))
axiom
--
-- compare
--
Og:ILIST(Octonion R,0):=map(x+-> octon(x.1,x.2,x.3,x.4,x.5,x.6,x.7,x.8),
1$SquareMatrix(8,FRAC INT)::List List FRAC INT)
Type: IndexedList
?(Octonion(Expression(Integer)),
0)
axiom
matrix [[Og.i * Og.j for j in 0..#Og-1] for i in 0..#Og-1]
Type: Matrix(Octonion(Expression(Integer)))
axiom
o1:O := scalar [subscript('o1,[i]) for i in 1..8]
Type: CaleyDickson
?(CaleyDickson
?(CaleyDickson
?(Expression(Integer),
i,
1),
j,
1),
k,
1)
axiom
o2:O := scalar [subscript('o2,[i]) for i in 1..8]
Type: CaleyDickson
?(CaleyDickson
?(CaleyDickson
?(Expression(Integer),
i,
1),
j,
1),
k,
1)
axiom
o3:O := scalar [subscript('o3,[i]) for i in 1..8]
Type: CaleyDickson
?(CaleyDickson
?(CaleyDickson
?(Expression(Integer),
i,
1),
j,
1),
k,
1)
axiom
-- normed?
test(norm(o1*o2)=norm(o1)*norm(o2))
Type: Boolean
axiom
-- Commutative?
test( o1 * o2 = o2 * o1 )
Type: Boolean
axiom
-- Associative?
test((o1 * o2) * o3 = o1 * (o2 * o3))
Type: Boolean
axiom
-- Alternative?
test((o1 * o2) * o1 = o1 * (o2 * o1))
Type: Boolean
Split-Octonions
Ref: http://en.wikipedia.org/wiki/Split-octonion
Note: Our table below is not identical the one shown in the reference where a different convention is used to define multiplication.
axiom
sO:=CaleyDickson(Q,'ℓ,-1)
Type: Type
axiom
rank()$sO
axiom
sOe:ILIST(sO,0) := construct entries basis()$sO
Type: IndexedList
?(CaleyDickson
?(CaleyDickson
?(CaleyDickson
?(Expression(Integer),
i,
1),
j,
1),
ℓ,
-1),
0)
axiom
matrix [[sOe.i * sOe.j for j in 0..#sOe-1] for i in 0..#sOe-1]
Type: Matrix(CaleyDickson
?(CaleyDickson
?(CaleyDickson
?(Expression(Integer),
i,
1),
j,
1),
ℓ,
-1))
axiom
so1:sO := scalar [subscript('so1,[i]) for i in 1..8]
Type: CaleyDickson
?(CaleyDickson
?(CaleyDickson
?(Expression(Integer),
i,
1),
j,
1),
ℓ,
-1)
axiom
so2:sO := scalar [subscript('so2,[i]) for i in 1..8]
Type: CaleyDickson
?(CaleyDickson
?(CaleyDickson
?(Expression(Integer),
i,
1),
j,
1),
ℓ,
-1)
axiom
so3:sO := scalar [subscript('so3,[i]) for i in 1..8]
Type: CaleyDickson
?(CaleyDickson
?(CaleyDickson
?(Expression(Integer),
i,
1),
j,
1),
ℓ,
-1)
axiom
-- Normed?
test(norm(so1*so2)=norm(so1)*norm(so2))
Type: Boolean
axiom
-- Commutative?
test( so1 * so2 = so2 * so1 )
Type: Boolean
axiom
-- Associative?
test((so1 * so2) * so3 = so1 * (so2 * so3))
Type: Boolean
axiom
-- Alternative?
test((so1 * so2) * so1 = - so1 * (so2 * so1))
Type: Boolean
Sedenions
Ref: http://en.wikipedia.org/wiki/Sedenion
axiom
S:=CaleyDickson(O,'l,1)
Type: Type
axiom
rank()$S
axiom
Se:ILIST(S,0) := construct entries basis()$S
Type: IndexedList
?(CaleyDickson
?(CaleyDickson
?(CaleyDickson
?(CaleyDickson
?(Expression(Integer),
i,
1),
j,
1),
k,
1),
l,
1),
0)
axiom
matrix [[Se.i * Se.j for j in 0..#Se-1] for i in 0..#Se-1]
Type: Matrix(CaleyDickson
?(CaleyDickson
?(CaleyDickson
?(CaleyDickson
?(Expression(Integer),
i,
1),
j,
1),
k,
1),
l,
1))
axiom
s1:S := scalar [subscript('s1,[i]) for i in 1..16]
Type: CaleyDickson
?(CaleyDickson
?(CaleyDickson
?(CaleyDickson
?(Expression(Integer),
i,
1),
j,
1),
k,
1),
l,
1)
axiom
s2:S := scalar [subscript('s2,[i]) for i in 1..16]
Type: CaleyDickson
?(CaleyDickson
?(CaleyDickson
?(CaleyDickson
?(Expression(Integer),
i,
1),
j,
1),
k,
1),
l,
1)
axiom
s3:S := scalar [subscript('s3,[i]) for i in 1..16]
Type: CaleyDickson
?(CaleyDickson
?(CaleyDickson
?(CaleyDickson
?(Expression(Integer),
i,
1),
j,
1),
k,
1),
l,
1)
axiom
-- normed?
test(norm(s1*s2)=norm(s1)*norm(s2))
Type: Boolean
axiom
-- Commutative
test( s1 * s2 = s2 * s1 )
Type: Boolean
axiom
-- Associative?
test( (s1 * s2) * s3 = s1 * (s2 * s3) )
Type: Boolean
axiom
-- Alternative?
test((s1 * s2) * s1 = - s1 * (s2 * s1))
Type: Boolean
axiom
-- Power Associateive?
test((s1 * s1) * s1 = s1 * (s1 * s1))
Type: Boolean
axiom
-- zero divisor
(Se.3 + Se.10) * (Se.6 - Se.15)
Type: CaleyDickson
?(CaleyDickson
?(CaleyDickson
?(CaleyDickson
?(Expression(Integer),
i,
1),
j,
1),
k,
1),
l,
1)