]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: simplify and justify the implementation of is_nilpotent() for elements.
authorMichael Orlitzky <michael@orlitzky.com>
Mon, 29 Jul 2019 04:36:33 +0000 (00:36 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Mon, 29 Jul 2019 04:36:33 +0000 (00:36 -0400)
mjo/eja/eja_algebra.py

index f88a5523bf7e63bc15608479bff6f05f63736936..edba0987e946a23e193f45c62fec5288a416e617 100644 (file)
@@ -1011,14 +1011,26 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra):
             """
             Return whether or not some power of this element is zero.
 
-            The superclass method won't work unless we're in an
-            associative algebra, and we aren't. However, we generate
-            an assocoative subalgebra and we're nilpotent there if and
-            only if we're nilpotent here (probably).
+            ALGORITHM:
+
+            We use Theorem 5 in Chapter III of Koecher, which says that
+            an element ``x`` is nilpotent if and only if ``x.operator()``
+            is nilpotent. And it is a basic fact of linear algebra that
+            an operator on an `n`-dimensional space is nilpotent if and
+            only if, when raised to the `n`th power, it equals the zero
+            operator (for example, see Axler Corollary 8.8).
 
             SETUP::
 
-                sage: from mjo.eja.eja_algebra import random_eja
+                sage: from mjo.eja.eja_algebra import (JordanSpinEJA,
+                ....:                                  random_eja)
+
+            EXAMPLES::
+
+                sage: J = JordanSpinEJA(3)
+                sage: x = sum(J.gens())
+                sage: x.is_nilpotent()
+                False
 
             TESTS:
 
@@ -1035,25 +1047,9 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra):
                 True
 
             """
-            # The element we're going to call "is_nilpotent()" on.
-            # Either myself, interpreted as an element of a finite-
-            # dimensional algebra, or an element of an associative
-            # subalgebra.
-            elt = None
-
-            if self.parent().is_associative():
-                elt = FiniteDimensionalAlgebraElement(self.parent(), self)
-            else:
-                V = self.span_of_powers()
-                assoc_subalg = self.subalgebra_generated_by()
-                # Mis-design warning: the basis used for span_of_powers()
-                # and subalgebra_generated_by() must be the same, and in
-                # the same order!
-                elt = assoc_subalg(V.coordinates(self.vector()))
-
-            # Recursive call, but should work since elt lives in an
-            # associative algebra.
-            return elt.is_nilpotent()
+            P = self.parent()
+            zero_operator = P.zero().operator()
+            return self.operator()**P.dimension() == zero_operator
 
 
         def is_regular(self):