login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for CaleyDickson revision 4 of 18

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
Editor: Bill Page
Time: 2011/04/16 20:07:24 GMT-7
Note: Octonions

changed:
-CaleyDickson(R:CommutativeRing,C:CommutativeRing,gamma:C):Exports == Implementation where
-  Exports ==> ComplexCategory(C) with
CaleyDickson(R:CommutativeRing,C:CommutativeRing,gen:Symbol,gamma:C):Exports == Implementation where
  CC ==> ComplexCategory
  Exports ==> CC(C) with

changed:
-    if C has ComplexCategory(R) then
    if C has CC(R) _
    or C has CC(CC(R)) _
    or C has CC(CC(CC(R))) then

changed:
-    coerce(x:C):% == per pair(x,0)

    coerce(x:%):OutputForm ==
      outr:=real(x)::OutputForm
      imag x = 0 => return outr
      outi := gen::OutputForm *imag(x)::OutputForm
      if imag x = 1 then
        outi := gen::OutputForm
      if imag x = -1 then
        outi := -(gen::OutputForm)
      if C has CC(R) then
        if imag x = -imaginary() then
          outi := -(gen::OutputForm)*imaginary()$C::OutputForm
      real x = 0 => return outi
      return outr + outi 


added:
    --coerce(x:C):% == per pair(x,0)

removed:
-    if C has ComplexCategory(R) then
-      if C has ComplexCategory(ComplexCategory(R)) then
-        coerce(x:%):OutputForm ==
-          outr:=real(x)::OutputForm
-          imag x = 0 => return outr
-          outi:=message("k")*imag(x)::OutputForm
-          imag x = 1 => outi:=message("k")
-          imag x = -1 => outi:= -message("k")
-          imag x = -imaginary() => -message("k")*imaginary()::OutputForm
-          real x = 0 => return outi
-          return outr + outi 
-      else
-        coerce(x:%):OutputForm ==
-          outr:=real(x)::OutputForm
-          imag x = 0 => return outr
-          outi:=message("j")*imag(x)::OutputForm
-          imag x = 1 => outi:=message("j")
-          imag x = -1 => outi:= -message("j")
-          imag x = -imaginary() => -message("j")*imaginary()::OutputForm
-          real x = 0 => return outi
-          return outr + outi 

changed:
-C:=CaleyDickson(FRAC INT, FRAC INT,1)
C:=CaleyDickson(FRAC INT, FRAC INT,'i,1)

changed:
-Q:=CaleyDickson(FRAC INT,C,1)
Q:=CaleyDickson(FRAC INT,C,'j,1)

added:

Octonions
\begin{axiom}
O:=CaleyDickson(FRAC INT,Q,'k,1)
gens5:List O:=[ _
  complex(complex(complex(1,0)$C,complex(0,0)$C)$Q,complex(complex(0,0)$C,complex(0,0)$C)$Q), _
  complex(complex(complex(0,1)$C,complex(0,0)$C)$Q,complex(complex(0,0)$C,complex(0,0)$C)$Q), _
  complex(complex(complex(0,0)$C,complex(1,0)$C)$Q,complex(complex(0,0)$C,complex(0,0)$C)$Q), _
  complex(complex(complex(0,0)$C,complex(0,1)$C)$Q,complex(complex(0,0)$C,complex(0,0)$C)$Q), _
  complex(complex(complex(0,0)$C,complex(0,0)$C)$Q,complex(complex(1,0)$C,complex(0,0)$C)$Q), _
  complex(complex(complex(0,0)$C,complex(0,0)$C)$Q,complex(complex(0,1)$C,complex(0,0)$C)$Q), _
  complex(complex(complex(0,0)$C,complex(0,0)$C)$Q,complex(complex(0,0)$C,complex(1,0)$C)$Q), _
  complex(complex(complex(0,0)$C,complex(0,0)$C)$Q,complex(complex(0,0)$C,complex(0,1)$C)$Q) ]

matrix [[gens5.i * gens5.j for j in 1..#gens5] for i in 1..#gens5]
--
-- compare
--
gens6:List Octonion(FRAC INT):=[ _
  octon(1,0,0,0,0,0,0,0), _
  octon(0,1,0,0,0,0,0,0), _
  octon(0,0,1,0,0,0,0,0), _
  octon(0,0,0,1,0,0,0,0), _
  octon(0,0,0,0,1,0,0,0), _
  octon(0,0,0,0,0,1,0,0), _
  octon(0,0,0,0,0,0,1,0), _
  octon(0,0,0,0,0,0,0,1)]
matrix [[gens6.i * gens6.j for j in 1..#gens6] for i in 1..#gens6]
\end{axiom}


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, ...

spad
)abbrev domain CALEY CaleyDickson
CaleyDickson(R:CommutativeRing,C:CommutativeRing,gen:Symbol,gamma:C):Exports == Implementation where
  CC ==> ComplexCategory
  Exports ==> CC(C) with
    if C has Field then Field
  Implementation ==> 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 CC(R) _ or C has CC(CC(R)) _ or C has CC(CC(CC(R))) 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:%):% == per pair(real x, -imag x)
if C has Field then inv(x:%):% == per(inv(real(conjugate x * x))$C * rep conjugate x) (x:% / y:%):% == x * inv(y)
coerce(x:%):OutputForm == outr:=real(x)::OutputForm imag x = 0 => return outr outi := gen::OutputForm *imag(x)::OutputForm if imag x = 1 then outi := gen::OutputForm if imag x = -1 then outi := -(gen::OutputForm) if C has CC(R) then if imag x = -imaginary() then outi := -(gen::OutputForm)*imaginary()$C::OutputForm real x = 0 => return outi return outr + outi
-- -- The following and many other funtctions are inherited from ComplexCategory -- -- To Do: -- 1) Check which other functions are still correct for higher-order algebras! -- --coerce(x:C):% == per pair(x,0) --basis():Vector % == vector [1,imaginary()] --(x:% - y:%):% == per(rep x - rep y) --imaginary():% == complex(0,1) --retract(x:%):C == -- imag x ~=0 => error "not retractable" -- real x --coerce(x:Integer):% == per pair(x::R::C,0)
-- 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/2285623756341733268-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.41 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.01 SEC.
compiling exported imag : $ -> C Time: 0 SEC.
compiling exported Zero : () -> $ Time: 0 SEC.
compiling exported zero? : $ -> Boolean Time: 0.01 SEC.
compiling exported One : () -> $ Time: 0 SEC.
compiling exported one? : $ -> Boolean Time: 0 SEC.
****** Domain: C already in scope augmenting C: (ComplexCategory R) compiling exported * : ($,$) -> $ Time: 0.07 SEC.
compiling exported conjugate : $ -> $ Time: 0 SEC.
****** Domain: C already in scope augmenting C: (ComplexCategory (ComplexCategory R)) compiling exported * : ($,$) -> $ Time: 0.02 SEC.
compiling exported conjugate : $ -> $ Time: 0.01 SEC.
****** Domain: C already in scope augmenting C: (ComplexCategory (ComplexCategory (ComplexCategory R))) compiling exported * : ($,$) -> $ Time: 0.02 SEC.
compiling exported conjugate : $ -> $ Time: 0.01 SEC.
compiling exported * : ($,$) -> $ Time: 0.01 SEC.
compiling exported conjugate : $ -> $ Time: 0 SEC.
****** Domain: C already in scope augmenting C: (Field) compiling exported inv : $ -> $ Time: 0.03 SEC.
compiling exported / : ($,$) -> $ Time: 0 SEC.
compiling exported coerce : $ -> OutputForm ****** Domain: C already in scope augmenting C: (ComplexCategory R) Time: 0.06 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: 2980)
;;; *** |CaleyDickson| REDEFINED
;;; *** |CaleyDickson| REDEFINED Time: 3.34 SEC.
Cumulative Statistics for Constructor CaleyDickson Time: 4.02 seconds
finalizing NRLIB CALEY Processing CaleyDickson for Browser database: --->-->CaleyDickson(): Missing Description ; compiling file "/var/zope2/var/LatexWiki/CALEY.NRLIB/CALEY.lsp" (written 18 APR 2011 07:06:55 PM):
; /var/zope2/var/LatexWiki/CALEY.NRLIB/CALEY.fasl written ; compilation finished in 0:00:00.849 ------------------------------------------------------------------------ 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
)set output tex on
 
axiom
)set output algebra off

Complex Numbers

axiom
C:=CaleyDickson(FRAC INT, FRAC INT,'i,1)

\label{eq1}\hbox{\axiomType{CaleyDickson}\ } (\hbox{\axiomType{Fraction}\ } (\hbox{\axiomType{Integer}\ }) , \hbox{\axiomType{Fraction}\ } (\hbox{\axiomType{Integer}\ }) , i , 1)(1)
Type: Type
axiom
gens1:List C:=[complex(1,0),complex(0,1)]

\label{eq2}\left[ 1, \: i \right](2)
Type: List(CaleyDickson?(Fraction(Integer),Fraction(Integer),i,1))
axiom
matrix [[gens1.i * gens1.j for j in 1..#gens1] for i in 1..#gens1]

\label{eq3}\left[ 
\begin{array}{cc}
1 & i 
\
i & - 1 
(3)
Type: Matrix(CaleyDickson?(Fraction(Integer),Fraction(Integer),i,1))
axiom
--
-- compare
--
gens2:List Complex(FRAC INT):=[1,imaginary()]

\label{eq4}\left[ 1, \: i \right](4)
Type: List(Complex(Fraction(Integer)))
axiom
matrix [[gens2.i * gens2.j for j in 1..#gens2] for i in 1..#gens2]

\label{eq5}\left[ 
\begin{array}{cc}
1 & i 
\
i & - 1 
(5)
Type: Matrix(Complex(Fraction(Integer)))

Quaternions

axiom
Q:=CaleyDickson(FRAC INT,C,'j,1)

\label{eq6}\hbox{\axiomType{CaleyDickson}\ } (\hbox{\axiomType{Fraction}\ } (\hbox{\axiomType{Integer}\ }) , \hbox{\axiomType{CaleyDickson}\ } (\hbox{\axiomType{Fraction}\ } (\hbox{\axiomType{Integer}\ }) , \hbox{\axiomType{Fraction}\ } (\hbox{\axiomType{Integer}\ }) , i , 1) , j , 1)(6)
Type: Type
axiom
gens3:List Q:=[ _
  complex(complex(1,0)$C,complex(0,0)$C), _
  complex(complex(0,1)$C,complex(0,0)$C), _
  complex(complex(0,0)$C,complex(1,0)$C), _
  complex(complex(0,0)$C,complex(0,1)$C)]

\label{eq7}\left[ 1, \: i , \: j , \:{j \  i}\right](7)
Type: List(CaleyDickson?(Fraction(Integer),CaleyDickson?(Fraction(Integer),Fraction(Integer),i,1),j,1))
axiom
matrix [[gens3.i * gens3.j for j in 1..#gens3] for i in 1..#gens3]

\label{eq8}\left[ 
\begin{array}{cccc}
1 & i & j &{j \  i}
\
i & - 1 &{j \  i}& - j 
\
j & -{j \  i}& - 1 & i 
\
{j \  i}& j & - i & - 1 
(8)
Type: Matrix(CaleyDickson?(Fraction(Integer),CaleyDickson?(Fraction(Integer),Fraction(Integer),i,1),j,1))
axiom
--
-- compare
--
gens4:List Quaternion(FRAC INT):=[ _
  quatern(1,0,0,0), _
  quatern(0,1,0,0), _
  quatern(0,0,1,0), _
  quatern(0,0,0,1)]

\label{eq9}\left[ 1, \: i , \: j , \: k \right](9)
Type: List(Quaternion(Fraction(Integer)))
axiom
matrix [[gens4.i * gens4.j for j in 1..#gens4] for i in 1..#gens4]

\label{eq10}\left[ 
\begin{array}{cccc}
1 & i & j & k 
\
i & - 1 & k & - j 
\
j & - k & - 1 & i 
\
k & j & - i & - 1 
(10)
Type: Matrix(Quaternion(Fraction(Integer)))

Octonions

axiom
O:=CaleyDickson(FRAC INT,Q,'k,1)

\label{eq11}\hbox{\axiomType{CaleyDickson}\ } (\hbox{\axiomType{Fraction}\ } (\hbox{\axiomType{Integer}\ }) , \hbox{\axiomType{CaleyDickson}\ } (\hbox{\axiomType{Fraction}\ } (\hbox{\axiomType{Integer}\ }) , \hbox{\axiomType{CaleyDickson}\ } (\hbox{\axiomType{Fraction}\ } (\hbox{\axiomType{Integer}\ }) , \hbox{\axiomType{Fraction}\ } (\hbox{\axiomType{Integer}\ }) , i , 1) , j , 1) , k , 1)(11)
Type: Type
axiom
gens5:List O:=[ _
  complex(complex(complex(1,0)$C,complex(0,0)$C)$Q,complex(complex(0,0)$C,complex(0,0)$C)$Q), _
  complex(complex(complex(0,1)$C,complex(0,0)$C)$Q,complex(complex(0,0)$C,complex(0,0)$C)$Q), _
  complex(complex(complex(0,0)$C,complex(1,0)$C)$Q,complex(complex(0,0)$C,complex(0,0)$C)$Q), _
  complex(complex(complex(0,0)$C,complex(0,1)$C)$Q,complex(complex(0,0)$C,complex(0,0)$C)$Q), _
  complex(complex(complex(0,0)$C,complex(0,0)$C)$Q,complex(complex(1,0)$C,complex(0,0)$C)$Q), _
  complex(complex(complex(0,0)$C,complex(0,0)$C)$Q,complex(complex(0,1)$C,complex(0,0)$C)$Q), _
  complex(complex(complex(0,0)$C,complex(0,0)$C)$Q,complex(complex(0,0)$C,complex(1,0)$C)$Q), _
  complex(complex(complex(0,0)$C,complex(0,0)$C)$Q,complex(complex(0,0)$C,complex(0,1)$C)$Q) ]

\label{eq12}\left[ 1, \: i , \: j , \:{j \  i}, \: k , \:{k \  i}, \:{k \  j}, \:{k \  j \  i}\right](12)
Type: List(CaleyDickson?(Fraction(Integer),CaleyDickson?(Fraction(Integer),CaleyDickson?(Fraction(Integer),Fraction(Integer),i,1),j,1),k,1))
axiom
matrix [[gens5.i * gens5.j for j in 1..#gens5] for i in 1..#gens5]

\label{eq13}\left[ 
\begin{array}{cccccccc}
1 & i & j &{j \  i}& k &{k \  i}&{k \  j}&{k \  j \  i}
\
i & - 1 &{j \  i}& - j &{k \  i}& - k &{k \ {\left(-{j \  i}\right)}}&{k \  j}
\
j & -{j \  i}& - 1 & i &{k \  j}&{k \  j \  i}& - k &{k \ {\left(- i \right)}}
\
{j \  i}& j & - i & - 1 &{k \  j \  i}&{k \ {\left(- j \right)}}&{k \  i}& - k 
\
k &{k \  i}&{k \  j}&{k \  j \  i}& - 1 & - i & - j & -{j \  i}
\
{k \  i}& - k &{k \  j \  i}&{k \ {\left(- j \right)}}& - i & 1 &{j \  i}& - j 
\
{k \  j}&{k \ {\left(-{j \  i}\right)}}& - k &{k \  i}& - j & -{j \  i}& 1 & i 
\
{k \  j \  i}&{k \  j}&{k \ {\left(- i \right)}}& - k & -{j \  i}& j & - i & 1 
(13)
Type: Matrix(CaleyDickson?(Fraction(Integer),CaleyDickson?(Fraction(Integer),CaleyDickson?(Fraction(Integer),Fraction(Integer),i,1),j,1),k,1))
axiom
--
-- compare
--
gens6:List Octonion(FRAC INT):=[ _
  octon(1,0,0,0,0,0,0,0), _
  octon(0,1,0,0,0,0,0,0), _
  octon(0,0,1,0,0,0,0,0), _
  octon(0,0,0,1,0,0,0,0), _
  octon(0,0,0,0,1,0,0,0), _
  octon(0,0,0,0,0,1,0,0), _
  octon(0,0,0,0,0,0,1,0), _
  octon(0,0,0,0,0,0,0,1)]

\label{eq14}\left[ 1, \: i , \: j , \: k , \: E , \: I , \: J , \: K \right](14)
Type: List(Octonion(Fraction(Integer)))
axiom
matrix [[gens6.i * gens6.j for j in 1..#gens6] for i in 1..#gens6]

\label{eq15}\left[ 
\begin{array}{cccccccc}
1 & i & j & k & E & I & J & K 
\
i & - 1 & k & - j & I & - E & - K & J 
\
j & - k & - 1 & i & J & K & - E & - I 
\
k & j & - i & - 1 & K & - J & I & - E 
\
E & - I & - J & - K & - 1 & i & j & k 
\
I & E & - K & J & - i & - 1 & - k & j 
\
J & K & E & - I & - j & k & - 1 & - i 
\
K & - J & I & E & - k & - j & i & - 1 
(15)
Type: Matrix(Octonion(Fraction(Integer)))