]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
mjo/hurwitz.py: update examples to use Sage's octonions
authorMichael Orlitzky <michael@orlitzky.com>
Wed, 8 Apr 2026 14:01:06 +0000 (10:01 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Wed, 8 Apr 2026 14:01:06 +0000 (10:01 -0400)
Use OctonionAlgebra rather than my custom Octonions. Tests pass
within huritz.py and matrix_algebra.py, but the EJA modules are
certainly broken.

mjo/hurwitz.py

index 144b7e14bfa4c0b7ebfa602e0b9f17059636fbf1..7ceebd3ed38dacbf091759201c3c00f9e54dc0bc 100644 (file)
@@ -617,74 +617,78 @@ class OctonionMatrixAlgebra(HurwitzMatrixAlgebra):
     EXAMPLES::
 
         sage: OctonionMatrixAlgebra(3)
-        Module of 3 by 3 matrices with entries in Octonion algebra with base
-        ring Algebraic Real Field over the scalar ring Algebraic Real Field
+        Module of 3 by 3 matrices with entries in Octonion algebra over
+        Algebraic Real Field over the scalar ring Algebraic Real Field
 
     ::
 
         sage: OctonionMatrixAlgebra(3,scalars=QQ)
-        Module of 3 by 3 matrices with entries in Octonion algebra with
-        base ring Rational Field over the scalar ring Rational Field
+        Module of 3 by 3 matrices with entries in Octonion algebra over
+        Rational Field over the scalar ring Rational Field
 
     ::
 
-        sage: O = Octonions(RR)
+        sage: O = OctonionAlgebra(RR)
         sage: A = OctonionMatrixAlgebra(1,O)
         sage: A
-        Module of 1 by 1 matrices with entries in Octonion algebra with
-        base ring Real Field with 53 bits of precision over the scalar
-        ring Algebraic Real Field
+        Module of 1 by 1 matrices with entries in Octonion algebra over
+        Real Field with 53 bits of precision over the scalar ring
+        Algebraic Real Field
         sage: A.one()
-        ┌─────────────────────┐
-        │ 1.00000000000000*e0 │
-        └─────────────────────┘
+        ┌──────────────────┐
+        │ 1.00000000000000 │
+        └──────────────────┘
+
+    The matrix algebra does **not** inherit the ``gens()`` behavior
+    from the entry algebra; we get a basis here::
+
         sage: A.gens()
-        (â\94\8câ\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\90
-         │ 1.00000000000000*e0 │
-         â\94\94â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\98,
-         â\94\8câ\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\90
-         │ 1.00000000000000*e1 │
-         â\94\94â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\98,
-         â\94\8câ\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\90
-         │ 1.00000000000000*e2 │
-         â\94\94â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\98,
-         â\94\8câ\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\90
-         │ 1.00000000000000*e3 │
-         â\94\94â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\98,
-         â\94\8câ\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\90
-         │ 1.00000000000000*e4 │
-         â\94\94â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\98,
+        (┌──────────────────┐
+         │ 1.00000000000000 │
+         └──────────────────┘,
+         ┌────────────────────┐
+         │ 1.00000000000000*i │
+         └────────────────────┘,
+         ┌────────────────────┐
+         │ 1.00000000000000*j │
+         └────────────────────┘,
+         ┌────────────────────┐
+         │ 1.00000000000000*k │
+         └────────────────────┘,
+         ┌────────────────────┐
+         │ 1.00000000000000*l │
+         └────────────────────┘,
          ┌─────────────────────┐
-         │ 1.00000000000000*e5 │
+         │ 1.00000000000000*li │
          └─────────────────────┘,
          ┌─────────────────────┐
-         │ 1.00000000000000*e6 │
+         │ 1.00000000000000*lj │
          └─────────────────────┘,
          ┌─────────────────────┐
-         │ 1.00000000000000*e7 │
+         │ 1.00000000000000*lk │
          └─────────────────────┘)
 
     ::
 
         sage: A = OctonionMatrixAlgebra(2)
-        sage: e0,e1,e2,e3,e4,e5,e6,e7 = A.entry_algebra().gens()
+        sage: e0,e1,e2,e3,e4,e5,e6,e7 = A.entry_algebra_gens()
         sage: A([ [e0+e4, e1+e5],
         ....:     [e2-e6, e3-e7] ])
-        â\94\8câ\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94¬â\94\80────────┐
-        │ e0 + e4 │ e1 + e5 │
-        â\94\9câ\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94¼â\94\80────────┤
-        │ e2 - e6 │ e3 - e7 │
-        â\94\94â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94´â\94\80────────┘
+        â\94\8câ\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94¬────────┐
+        │ 1 + l  │ i + li │
+        â\94\9câ\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94¼────────┤
+        │ j - lj │ k - lk │
+        â\94\94â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94\80â\94´────────┘
 
     ::
 
         sage: A1 = OctonionMatrixAlgebra(1,scalars=QQ)
         sage: A2 = OctonionMatrixAlgebra(1,scalars=QQ)
         sage: cartesian_product([A1,A2])
-        Module of 1 by 1 matrices with entries in Octonion algebra with
-        base ring Rational Field over the scalar ring Rational Field (+)
-        Module of 1 by 1 matrices with entries in Octonion algebra with
-        base ring Rational Field over the scalar ring Rational Field
+        Module of 1 by 1 matrices with entries in Octonion algebra over
+        Rational Field over the scalar ring Rational Field (+)
+        Module of 1 by 1 matrices with entries in Octonion algebra over
+        Rational Field over the scalar ring Rational Field
 
     TESTS::
 
@@ -696,7 +700,8 @@ class OctonionMatrixAlgebra(HurwitzMatrixAlgebra):
     """
     def __init__(self, n, entry_algebra=None, scalars=AA, **kwargs):
         if entry_algebra is None:
-            entry_algebra = Octonions(field=scalars)
+            from sage.algebras.octonion_algebra import OctonionAlgebra
+            entry_algebra = OctonionAlgebra(scalars)
         super().__init__(n,
                          entry_algebra,
                          scalars,