Eric Drechsel <[EMAIL PROTECTED]> writes:

> We want to compute with octonions in Sage, and discussed at our
> meeting last night possibly implementing such an algebra.
>
> As I understand it, multiplication of octonions can be implemented on
> top of the quaternions in a simple way using the Cayley-Dickson
> construction http://en.wikipedia.org/wiki/Octonion#Cayley-Dickson_construction
> .

If you define A_0 to be the reals and A_n to be the Cayley-Dickson
construction applied to A_{n-1}, then A_3 is the octonions.  More
generally, write A_n(F) for the Cayley-Dickson construction applied
to A_{n-1}(F), where A_0 = F.

I've done lots of computations with A_4(float), A_5(float) and
A_6(float) in python, but not using Sage.  I think the cleanest approach
is to define a function CayleyDickson that takes a class representing a
*-algebra and produces a new class representing the result of applying
the Cayley-Dickson construction.  This allows you to change the base
"field" from float to int, Z, Z[x], high-precision floats, or whatever
you need for a particular application.

Potential problems:

- If I call CayleyDickson(float) twice, do I get a new class each time?

- How to handle coercions between A_n(F) and A_m(F)?  And between A_n(F)
  and A_n(F')?  (F and F' are ground rings with *.)

- Efficiency.  In my application, I was multiplying elements of
  A_n(float) zillions of times, and this was *way* to slow using
  the obvious recursive method in python.  (If I recall correctly,
  the time scales like 4**n.)

I instead worked with a class that directly implemented A_n(float)
using numpy arrays, and used weave to compile some inline C code for
the multiplication operation.  (Cython/Pyrex might be just as good for
this, but I'm not sure if they can directly access numpy arrays as C
arrays.)  It falls back to using python for the multiplication for
"object" arrays, which allows for changing float to other classes,
but is awkward.

I'm not sure how to get the best of both worlds.  Maybe the first
way, with some clever Cython/Pyrex, could be made both flexible 
and efficient?  Or maybe the first way, with some special casing
to speed up common cases?

Dan


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to