From 207dd5b181cee27054080be2c0e6c300850358bf Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 29 Jul 2019 01:03:20 -0400 Subject: [PATCH] eja: add more regularity and degree tests. --- mjo/eja/eja_algebra.py | 54 +++++++++++++++++++++++++++++++++++++----- 1 file changed, 48 insertions(+), 6 deletions(-) diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index edba098..ad2afbd 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -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() -- 2.44.2