From: Michael Orlitzky Date: Fri, 6 Nov 2020 14:22:45 +0000 (-0500) Subject: eja: make all tests work in trivial algebras. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=f807c8c9046723a059eb4eea03dff89293510160;p=sage.d.git eja: make all tests work in trivial algebras. This lets us drop the "nontrivial" argument to the random_eja() function, because now we don't need it. --- diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index ded2df6..055bbbd 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -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(): diff --git a/mjo/eja/eja_element.py b/mjo/eja/eja_element.py index cf213a7..c5cbef9 100644 --- a/mjo/eja/eja_element.py +++ b/mjo/eja/eja_element.py @@ -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