From tplate at blackmesacapital.com  Fri Jul 29 22:12:13 2005
From: tplate at blackmesacapital.com (Tony Plate)
Date: Fri, 29 Jul 2005 14:12:13 -0600
Subject: [Rd] octonions
In-Reply-To: <245FBCC1-7FA2-4148-8F87-0C5D82D53DE8@soc.soton.ac.uk>
References: <245FBCC1-7FA2-4148-8F87-0C5D82D53DE8@soc.soton.ac.uk>
Message-ID: <42EA8D9D.6070000@blackmesacapital.com>

It's reasonably easy to define an S3 class for vectors (e.g., 
"octonion") and then define operator methods (for all operators other 
than matrix operators) to do what you want with that class.  To do this 
you need to define a function Ops.octonion.  All of this is easily done 
in pure R. I just wrote a package that does just that for a vector class 
with a different algebra (I can send you a copy if you could use any 
hints on those aspects).  I'm not sure of the best way of defining a 
method for '%*%'.   I think it's possible to use setMethod() to define a 
method for '%*%', but I haven't played with that much (my initial 
attempts have worked, but warnings have been generated by setMethod).

-- Tony Plate

Robin Hankin wrote:
> Hi
> 
> I  thought it would be fun to develop R functionality for
> the octonions (there is  already some work on quaternions).
> 
> The octonions are an 8 dimensional algebra over the reals, so an  
> octonion
> may nicely be represented as a real vector of length 8.  Applications
> are many and varied, mostly quantum mechanics.
> 
> I would like to develop some R functionality in this area.
> My first problem is how to get (eg) a matrix whose entries are  
> octonions?
> It would  be nice for a %*% b to behave sensibly when a and b are
> matrices with octonion elements.
> 
> Octonions  are not associative [that is,
> x*(y*z) != (x*y)*z ] or commutative [x*y != y*x].
> One usually sees an 8-by-8 table that gives the products.
> 
> At this stage, I'm polling for ideas on overall structure.
> Would a package be the best way forward?  Or
> writing an equivalent of complex.c? Or is there
> another approach that would be better? The
> basic multiplication table is easily implemented in C,
> and I now have an (untested) R function OctonionProduct(. , .)
> that multiplies two octonions; but I
> am struggling to see how to make this play nicely with R: it's not
> obvious how to make octonion matrices multiply as they should,
> in the same way that (eg) complex matrices do.
> 
> Perhaps we could define "*" and "/"  appropriately for vectors of class
> "octonion" (if such a thing makes sense):  or is there a better
> way?  Also, Mod(), Re(), and perhaps
> Conj() would have to be generalized to work with octonions.
> 
> 
> comments please!
> 
> 
> --
> Robin Hankin
> Uncertainty Analyst
> National Oceanography Centre, Southampton
> European Way, Southampton SO14 3ZH, UK
>   tel  023-8059-7743
> 
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>



[Rd] octonions
Tony Plate