]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
mjo/eja: update to use Sage's octonions
authorMichael Orlitzky <michael@orlitzky.com>
Wed, 8 Apr 2026 23:50:53 +0000 (19:50 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Thu, 9 Apr 2026 00:30:35 +0000 (20:30 -0400)
mjo/eja/eja_algebra.py
mjo/eja/eja_element.py

index 2a3b71b754d10ac3d9903efc33bf0094db05b26a..5fefdbf4963568259402fe3bc86ffd1299515491 100644 (file)
@@ -2041,11 +2041,9 @@ class HermitianMatrixEJA(EJA):
 
         """
         tr = (X*Y).trace()
-        if hasattr(tr, 'coefficient'):
-            # Works for octonions, and has to come first because they
-            # also have a "real()" method that doesn't return an
-            # element of the scalar ring.
-            return tr.coefficient(0)
+        if hasattr(tr, 'real_part'):
+            # Works for octonions.
+            return tr.real_part()
         elif hasattr(tr, 'coefficient_tuple'):
             # Works for quaternions.
             return tr.coefficient_tuple()[0]
@@ -2345,7 +2343,7 @@ class OctonionHermitianEJA(HermitianMatrixEJA, RationalBasisEJA, ConcreteEJA):
 
         sage: from mjo.eja.eja_algebra import (EJA,
         ....:                                  OctonionHermitianEJA)
-        sage: from mjo.hurwitz import Octonions, OctonionMatrixAlgebra
+        sage: from mjo.hurwitz import OctonionMatrixAlgebra
 
     EXAMPLES:
 
@@ -2361,16 +2359,12 @@ class OctonionHermitianEJA(HermitianMatrixEJA, RationalBasisEJA, ConcreteEJA):
     After a change-of-basis, the 2-by-2 algebra has the same
     multiplication table as the ten-dimensional Jordan spin algebra::
 
-        sage: A = OctonionMatrixAlgebra(2,Octonions(QQ),QQ)
+        sage: A = OctonionMatrixAlgebra(2, OctonionAlgebra(QQ), QQ)
         sage: b = OctonionHermitianEJA._denormalized_basis(A)
         sage: basis = (b[0] + b[9],) + b[1:9] + (b[0] - b[9],)
         sage: jp = OctonionHermitianEJA.jordan_product
         sage: ip = OctonionHermitianEJA.trace_inner_product
-        sage: J = EJA(basis,
-        ....:                          jp,
-        ....:                          ip,
-        ....:                          field=QQ,
-        ....:                          orthonormalize=False)
+        sage: J = EJA(basis, jp, ip, field=QQ, orthonormalize=False)
         sage: J.multiplication_table()
         ┌────╥────┬────┬────┬────┬────┬────┬────┬────┬────┬────┐
         │ *  ║ b0 │ b1 │ b2 │ b3 │ b4 │ b5 │ b6 │ b7 │ b8 │ b9 │
@@ -2409,13 +2403,13 @@ class OctonionHermitianEJA(HermitianMatrixEJA, RationalBasisEJA, ConcreteEJA):
         sage: J.one()
         b0 + b9 + b26
         sage: J.one().to_matrix()
-        â\94\8câ\94\80â\94\80â\94\80â\94\80â\94¬â\94\80â\94\80â\94\80â\94\80â\94¬â\94\80───┐
-        │ e0 │ 0  │ 0  │
-        â\94\9câ\94\80â\94\80â\94\80â\94\80â\94¼â\94\80â\94\80â\94\80â\94\80â\94¼â\94\80───┤
-        │ 0  │ e0 │ 0  │
-        â\94\9câ\94\80â\94\80â\94\80â\94\80â\94¼â\94\80â\94\80â\94\80â\94\80â\94¼â\94\80───┤
-        │ 0  │ 0  │ e0 │
-        â\94\94â\94\80â\94\80â\94\80â\94\80â\94´â\94\80â\94\80â\94\80â\94\80â\94´â\94\80───┘
+        â\94\8câ\94\80â\94\80â\94\80â\94¬â\94\80â\94\80â\94\80â\94¬───┐
+        │ 1 │ 0 │ 0 │
+        â\94\9câ\94\80â\94\80â\94\80â\94¼â\94\80â\94\80â\94\80â\94¼───┤
+        │ 0 │ 1 │ 0 │
+        â\94\9câ\94\80â\94\80â\94\80â\94¼â\94\80â\94\80â\94\80â\94¼───┤
+        │ 0 │ 0 │ 1 │
+        â\94\94â\94\80â\94\80â\94\80â\94´â\94\80â\94\80â\94\80â\94´───┘
 
     The 2-by-2 algebra is isomorphic to the ten-dimensional Jordan
     spin algebra, but just to be sure, we recompute its rank::
index 55f8a1050d5d9716cbe95ff2d4fdb115ecef3d35..af905e7a71c22cd07177f88de8d23230f6f98d53 100644 (file)
@@ -399,16 +399,20 @@ class EJAElement(IndexedFreeModuleElement):
             True
 
         There's a formula for the determinant of the Albert algebra
-        (Yokota, Section 2.1)::
+        (Yokota, Exceptional Lie Groups, Section 2.1) and ours agrees
+        with it. Note that Sage's octonion multiplication table is
+        transposed from the usual one (i.e. Yokota's), so we have
+        reversed the order of the terms in each octonion product
+        below::
 
             sage: def albert_det(x):
             ....:     X = x.to_matrix()
-            ....:     res  = X[0,0]*X[1,1]*X[2,2]
-            ....:     res += 2*(X[1,2]*X[2,0]*X[0,1]).real()
-            ....:     res -= X[0,0]*X[1,2]*X[2,1]
-            ....:     res -= X[1,1]*X[2,0]*X[0,2]
-            ....:     res -= X[2,2]*X[0,1]*X[1,0]
-            ....:     return res.leading_coefficient()
+            ....:     res  = X[2,2]*X[1,1]*X[0,0]
+            ....:     res += 2*(X[0,1]*X[2,0]*X[1,2]).real_part()
+            ....:     res -= X[2,1]*X[1,2]*X[0,0]
+            ....:     res -= X[0,2]*X[2,0]*X[1,1]
+            ....:     res -= X[1,0]*X[0,1]*X[2,2]
+            ....:     return res
             sage: J = AlbertEJA(field=QQ, orthonormalize=False)
             sage: xs = J.random_elements(10)
             sage: all( albert_det(x) == x.det() for x in xs )