From: Michael Orlitzky Date: Wed, 8 Apr 2026 23:50:53 +0000 (-0400) Subject: mjo/eja: update to use Sage's octonions X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=37dfd6af731f7b968e234e85fab52646c871c52a;p=sage.d.git mjo/eja: update to use Sage's octonions --- diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index 2a3b71b..5fefdbf 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -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() - ┌────┬────┬────┐ - │ e0 │ 0 │ 0 │ - ├────┼────┼────┤ - │ 0 │ e0 │ 0 │ - ├────┼────┼────┤ - │ 0 │ 0 │ e0 │ - └────┴────┴────┘ + ┌───┬───┬───┐ + │ 1 │ 0 │ 0 │ + ├───┼───┼───┤ + │ 0 │ 1 │ 0 │ + ├───┼───┼───┤ + │ 0 │ 0 │ 1 │ + └───┴───┴───┘ The 2-by-2 algebra is isomorphic to the ten-dimensional Jordan spin algebra, but just to be sure, we recompute its rank:: diff --git a/mjo/eja/eja_element.py b/mjo/eja/eja_element.py index 55f8a10..af905e7 100644 --- a/mjo/eja/eja_element.py +++ b/mjo/eja/eja_element.py @@ -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 )