From f7084ccf4fcf16c3f457f192d63a35f6ff5c1cbc Mon Sep 17 00:00:00 2001 From: Michael Orlitzky Date: Tue, 24 Nov 2020 23:26:39 -0500 Subject: [PATCH] eja: return the polynomial ring R[X1,...,XN] from a method. --- mjo/eja/eja_algebra.py | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index c569098..21718ee 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -374,6 +374,28 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule): return (t**r + sum( a[k]*(t**k) for k in range(r) )) + def coordinate_polynomial_ring(self): + r""" + The multivariate polynomial ring in which this algebra's + :meth:`characteristic_polynomial_of` lives. + + SETUP:: + + sage: from mjo.eja.eja_algebra import (HadamardEJA, + ....: RealSymmetricEJA) + + EXAMPLES:: + + sage: J = HadamardEJA(2) + sage: J.coordinate_polynomial_ring() + Multivariate Polynomial Ring in X1, X2... + sage: J = RealSymmetricEJA(3,QQ) + sage: J.coordinate_polynomial_ring() + Multivariate Polynomial Ring in X1, X2, X3, X4, X5, X6... + + """ + var_names = tuple( "X%d" % z for z in range(1, self.dimension()+1) ) + return PolynomialRing(self.base_ring(), var_names) def inner_product(self, x, y): """ @@ -854,8 +876,7 @@ class FiniteDimensionalEuclideanJordanAlgebra(CombinatorialFreeModule): of" function. """ n = self.dimension() - var_names = [ "X" + str(z) for z in range(1,n+1) ] - R = PolynomialRing(self.base_ring(), var_names) + R = self.coordinate_polynomial_ring() vars = R.gens() F = R.fraction_field() -- 2.44.2