From ffabf130fc8fa05e68d9b3d55a1f3ccf89f5e390 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Wed, 4 Nov 2020 10:14:52 -0500 Subject: [PATCH] eja: fix the determinant in trivial algebras. --- mjo/eja/eja_element.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/mjo/eja/eja_element.py b/mjo/eja/eja_element.py index 926f2bf..0953b2f 100644 --- a/mjo/eja/eja_element.py +++ b/mjo/eja/eja_element.py @@ -346,6 +346,7 @@ class FiniteDimensionalEuclideanJordanAlgebraElement(IndexedFreeModuleElement): SETUP:: sage: from mjo.eja.eja_algebra import (JordanSpinEJA, + ....: TrivialEJA, ....: random_eja) EXAMPLES:: @@ -364,6 +365,17 @@ class FiniteDimensionalEuclideanJordanAlgebraElement(IndexedFreeModuleElement): sage: x.det() -1 + The determinant of the sole element in the rank-zero trivial + algebra is ``1``, by three paths of reasoning. First, its + characteristic polynomial is a constant ``1``, so the constant + term in that polynomial is ``1``. Second, the characteristic + polynomial evaluated at zero is again ``1``. And finally, the + (empty) product of its eigenvalues is likewise just unity:: + + sage: J = TrivialEJA() + sage: J.zero().det() + 1 + TESTS: An element is invertible if and only if its determinant is @@ -382,10 +394,16 @@ class FiniteDimensionalEuclideanJordanAlgebraElement(IndexedFreeModuleElement): sage: x,y = J.random_elements(2) sage: (x*y).det() == x.det()*y.det() True - """ P = self.parent() r = P.rank() + + if r == 0: + # Special case, since we don't get the a0=1 + # coefficient when the rank of the algebra + # is zero. + return P.base_ring().one() + p = P._charpoly_coefficients()[0] # The _charpoly_coeff function already adds the factor of -1 # to ensure that _charpoly_coefficients()[0] is really what -- 2.44.2