From 4ee70bf0e7a96a122d146a6f72dad101772ae6dc Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 8 Apr 2026 10:01:06 -0400 Subject: [PATCH] mjo/hurwitz.py: update examples to use Sage's octonions 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 | 85 ++++++++++++++++++++++++++------------------------ 1 file changed, 45 insertions(+), 40 deletions(-) diff --git a/mjo/hurwitz.py b/mjo/hurwitz.py index 144b7e1..7ceebd3 100644 --- a/mjo/hurwitz.py +++ b/mjo/hurwitz.py @@ -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() - (┌─────────────────────┐ - │ 1.00000000000000*e0 │ - └─────────────────────┘, - ┌─────────────────────┐ - │ 1.00000000000000*e1 │ - └─────────────────────┘, - ┌─────────────────────┐ - │ 1.00000000000000*e2 │ - └─────────────────────┘, - ┌─────────────────────┐ - │ 1.00000000000000*e3 │ - └─────────────────────┘, - ┌─────────────────────┐ - │ 1.00000000000000*e4 │ - └─────────────────────┘, + (┌──────────────────┐ + │ 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] ]) - ┌─────────┬─────────┐ - │ e0 + e4 │ e1 + e5 │ - ├─────────┼─────────┤ - │ e2 - e6 │ e3 - e7 │ - └─────────┴─────────┘ + ┌────────┬────────┐ + │ 1 + l │ i + li │ + ├────────┼────────┤ + │ j - lj │ k - lk │ + └────────┴────────┘ :: 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, -- 2.53.0