]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: add more regularity and degree tests.
authorMichael Orlitzky <michael@orlitzky.com>
Mon, 29 Jul 2019 05:03:20 +0000 (01:03 -0400)
committerMichael Orlitzky <michael@orlitzky.com>
Mon, 29 Jul 2019 05:03:20 +0000 (01:03 -0400)
mjo/eja/eja_algebra.py

index edba0987e946a23e193f45c62fec5288a416e617..ad2afbda465ca37bb1f0e940b8e5fb72b89cdba0 100644 (file)
@@ -1058,7 +1058,8 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra):
 
             SETUP::
 
-                sage: from mjo.eja.eja_algebra import JordanSpinEJA
+                sage: from mjo.eja.eja_algebra import (JordanSpinEJA,
+                ....:                                  random_eja)
 
             EXAMPLES:
 
@@ -1077,20 +1078,43 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra):
                 True
                 True
 
+            TESTS:
+
+            The zero element should never be regular::
+
+                sage: set_random_seed()
+                sage: J = random_eja()
+                sage: J.zero().is_regular()
+                False
+
+            The unit element isn't regular unless the algebra happens to
+            consist of only its scalar multiples::
+
+                sage: set_random_seed()
+                sage: J = random_eja()
+                sage: J.dimension() == 1 or not J.one().is_regular()
+                True
+
             """
             return self.degree() == self.parent().rank()
 
 
         def degree(self):
             """
-            Compute the degree of this element the straightforward way
-            according to the definition; by appending powers to a list
-            and figuring out its dimension (that is, whether or not
-            they're linearly dependent).
+            Return the degree of this element, which is defined to be
+            the degree of its minimal polynomial.
+
+            ALGORITHM:
+
+            For now, we skip the messy minimal polynomial computation
+            and instead return the dimension of the vector space spanned
+            by the powers of this element. The latter is a bit more
+            straightforward to compute.
 
             SETUP::
 
-                sage: from mjo.eja.eja_algebra import JordanSpinEJA
+                sage: from mjo.eja.eja_algebra import (JordanSpinEJA,
+                ....:                                  random_eja)
 
             EXAMPLES::
 
@@ -1111,6 +1135,24 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra):
                 sage: x == x.coefficient(0)*J.one() or x.degree() == 2
                 True
 
+            TESTS:
+
+            The zero and unit elements are both of degree one::
+
+                sage: set_random_seed()
+                sage: J = random_eja()
+                sage: J.zero().degree()
+                1
+                sage: J.one().degree()
+                1
+
+            Our implementation agrees with the definition::
+
+                sage: set_random_seed()
+                sage: x = random_eja().random_element()
+                sage: x.degree() == x.minimal_polynomial().degree()
+                True
+
             """
             return self.span_of_powers().dimension()