X-Git-Url: http://gitweb.michael.orlitzky.com/?a=blobdiff_plain;f=mjo%2Feja%2Feja_element.py;h=cf213a7a0f85d2e6eeb0edb13cba14b2bd8a49d6;hb=e32c1c6bffd4cc58b870a4471e2c0577941c2425;hp=926f2bf57a612c71eab53b693daa1e3f559ad6bc;hpb=823fb2a587e26436f46854fe44be0e8df46a6715;p=sage.d.git diff --git a/mjo/eja/eja_element.py b/mjo/eja/eja_element.py index 926f2bf..cf213a7 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 @@ -1300,12 +1318,13 @@ class FiniteDimensionalEuclideanJordanAlgebraElement(IndexedFreeModuleElement): TESTS: Ensure that we can find an idempotent in a non-trivial algebra - where there are non-nilpotent elements:: + where there are non-nilpotent elements, or that we get the dumb + solution in the trivial algebra:: sage: set_random_seed() - sage: J = random_eja(nontrivial=True) + sage: J = random_eja() sage: x = J.random_element() - sage: while x.is_nilpotent(): + sage: while x.is_nilpotent() and not J.is_trivial(): ....: x = J.random_element() sage: c = x.subalgebra_idempotent() sage: c^2 == c