From: Michael Orlitzky Date: Tue, 15 Oct 2019 12:27:44 +0000 (-0400) Subject: eja: define the trace of an element in a trivial algebra. X-Git-Url: https://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=73ba2d67c0850074e655b4da61aa021e6d9b6816;p=sage.d.git eja: define the trace of an element in a trivial algebra. --- diff --git a/mjo/eja/eja_element.py b/mjo/eja/eja_element.py index 2eb2677..bd45b17 100644 --- a/mjo/eja/eja_element.py +++ b/mjo/eja/eja_element.py @@ -1248,6 +1248,12 @@ class FiniteDimensionalEuclideanJordanAlgebraElement(IndexedFreeModuleElement): """ P = self.parent() r = P.rank() + + if r == 0: + # Special case for the trivial algebra where + # the trace is an empty sum. + return P.base_ring().zero() + p = P._charpoly_coeff(r-1) # The _charpoly_coeff function already adds the factor of # -1 to ensure that _charpoly_coeff(r-1) is really what