]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
octonions: add Cayley-Dickson representation.
authorMichael Orlitzky <michael@orlitzky.com>
Tue, 2 Mar 2021 03:32:21 +0000 (22:32 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Tue, 2 Mar 2021 03:32:21 +0000 (22:32 -0500)
mjo/octonions.py

index f6e222eebf7734a968dfa46a478d64ea7631d6cf..cd25f18a6500b45ce621fa9ae94b6d7c28760750 100644 (file)
@@ -1,3 +1,4 @@
+from sage.algebras.quatalg.quaternion_algebra import QuaternionAlgebra
 from sage.combinat.free_module import CombinatorialFreeModule
 from sage.modules.with_basis.indexed_element import IndexedFreeModuleElement
 from sage.categories.magmatic_algebras import MagmaticAlgebras
@@ -171,6 +172,52 @@ class Octonion(IndexedFreeModuleElement):
             raise ValueError("zero is not invertible")
         return self.conjugate()/self._norm_squared()
 
+
+    def cayley_dickson(self, Q=None):
+        r"""
+        Return the Cayley-Dickson representation of this element in terms
+        of the quaternion algebra ``Q``.
+
+        The Cayley-Dickson representation is an identification of
+        octionions `x` and `y` with pairs of quaternions `(a,b)` and
+        `(c,d)` respectively such that:
+
+        * `x + y = (a+b, c+d)`
+        * `xy` = (ac - \bar{d}*b, da + b\bar{c})`
+        * `\bar{x} = (a,-b)`
+
+        where `\bar{x}` denotes the conjugate of `x`.
+
+        SETUP::
+
+            sage: from mjo.octonions import Octonions
+
+        EXAMPLES::
+
+            sage: O = Octonions()
+            sage: x = sum(O.gens())
+            sage: x.cayley_dickson()
+            (1 + i + j + k, 1 + i + j + k)
+
+        """
+        if Q is None:
+            Q = QuaternionAlgebra(self.base_ring(), -1, -1)
+
+        i,j,k = Q.gens()
+        a = (self.coefficient(0)*Q.one() +
+             self.coefficient(1)*i +
+             self.coefficient(2)*j +
+             self.coefficient(3)*k )
+        b = (self.coefficient(4)*Q.one() +
+             self.coefficient(5)*i +
+             self.coefficient(6)*j +
+             self.coefficient(7)*k )
+
+        from sage.categories.sets_cat import cartesian_product
+        P = cartesian_product([Q,Q])
+        return P((a,b))
+
+
 class Octonions(CombinatorialFreeModule):
     r"""
     SETUP::