From 0e576704d235f1818b4ecd9f6ac0bdd5823fd745 Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Mon, 22 Jul 2019 16:50:50 -0400 Subject: [PATCH] eja: switch to the "real" element characteristic_polynomial() implementation. --- mjo/eja/euclidean_jordan_algebra.py | 38 ++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/mjo/eja/euclidean_jordan_algebra.py b/mjo/eja/euclidean_jordan_algebra.py index b5cef0a..421c70b 100644 --- a/mjo/eja/euclidean_jordan_algebra.py +++ b/mjo/eja/euclidean_jordan_algebra.py @@ -410,17 +410,37 @@ class FiniteDimensionalEuclideanJordanAlgebra(FiniteDimensionalAlgebra): def characteristic_polynomial(self): """ - Return my characteristic polynomial (if I'm a regular - element). + Return the characteristic polynomial of this element. + + EXAMPLES: + + The rank of `R^3` is three, and the minimal polynomial of + the identity element is `(t-1)` from which it follows that + the characteristic polynomial should be `(t-1)^3`:: + + sage: J = RealCartesianProductEJA(3) + sage: J.one().characteristic_polynomial() + t^3 - 3*t^2 + 3*t - 1 + + Likewise, the characteristic of the zero element in the + rank-three algebra `R^{n}` should be `t^{3}`:: + + sage: J = RealCartesianProductEJA(3) + sage: J.zero().characteristic_polynomial() + t^3 + + The characteristic polynomial of an element should evaluate + to zero on that element:: + + sage: set_random_seed() + sage: x = RealCartesianProductEJA(3).random_element() + sage: p = x.characteristic_polynomial() + sage: x.apply_univariate_polynomial(p) + 0 - Eventually this should be implemented in terms of the parent - algebra's characteristic polynomial that works for ALL - elements. """ - if self.is_regular(): - return self.minimal_polynomial() - else: - raise NotImplementedError('irregular element') + p = self.parent().characteristic_polynomial() + return p(*self.vector()) def inner_product(self, other): -- 2.44.2