]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: make all tests work in trivial algebras.
authorMichael Orlitzky <michael@orlitzky.com>
Fri, 6 Nov 2020 14:22:45 +0000 (09:22 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Fri, 6 Nov 2020 14:22:45 +0000 (09:22 -0500)
This lets us drop the "nontrivial" argument to the random_eja()
function, because now we don't need it.

mjo/eja/eja_algebra.py
mjo/eja/eja_element.py

index ded2df691d95eca3f4b9d25c8b0c77330b5b0c5a..055bbbda83d7576fda8f5e1794d759c2eee467bc 100644 (file)
@@ -903,7 +903,7 @@ class HadamardEJA(FiniteDimensionalEuclideanJordanAlgebra):
         return x.to_vector().inner_product(y.to_vector())
 
 
-def random_eja(field=AA, nontrivial=False):
+def random_eja(field=AA):
     """
     Return a "random" finite-dimensional Euclidean Jordan Algebra.
 
@@ -917,21 +917,17 @@ def random_eja(field=AA, nontrivial=False):
         Euclidean Jordan algebra of dimension...
 
     """
-    eja_classes = [HadamardEJA,
-                   JordanSpinEJA,
-                   RealSymmetricEJA,
-                   ComplexHermitianEJA,
-                   QuaternionHermitianEJA]
-    if not nontrivial:
-        eja_classes.append(TrivialEJA)
-    classname = choice(eja_classes)
+    classname = choice([TrivialEJA,
+                        HadamardEJA,
+                        JordanSpinEJA,
+                        RealSymmetricEJA,
+                        ComplexHermitianEJA,
+                        QuaternionHermitianEJA])
     return classname.random_instance(field=field)
 
 
 
 
-
-
 class MatrixEuclideanJordanAlgebra(FiniteDimensionalEuclideanJordanAlgebra):
     @staticmethod
     def _max_test_case_size():
index cf213a7a0f85d2e6eeb0edb13cba14b2bd8a49d6..c5cbef9ebca32c2789ece22b0f9c4c46e6fb34a2 100644 (file)
@@ -875,13 +875,18 @@ class FiniteDimensionalEuclideanJordanAlgebraElement(IndexedFreeModuleElement):
         TESTS:
 
         The minimal polynomial of the identity and zero elements are
-        always the same::
+        always the same, except in trivial algebras where the minimal
+        polynomial of the unit/zero element is ``1``::
 
             sage: set_random_seed()
-            sage: J = random_eja(nontrivial=True)
-            sage: J.one().minimal_polynomial()
+            sage: J = random_eja()
+            sage: mu = J.one().minimal_polynomial()
+            sage: t = mu.parent().gen()
+            sage: mu + int(J.is_trivial())*(t-2)
             t - 1
-            sage: J.zero().minimal_polynomial()
+            sage: mu = J.zero().minimal_polynomial()
+            sage: t = mu.parent().gen()
+            sage: mu + int(J.is_trivial())*(t-1)
             t
 
         The degree of an element is (by one definition) the degree