]> gitweb.michael.orlitzky.com - sage.d.git/commitdiff
eja: return the polynomial ring R[X1,...,XN] from a method.
authorMichael Orlitzky <michael@orlitzky.com>
Wed, 25 Nov 2020 04:26:39 +0000 (23:26 -0500)
committerMichael Orlitzky <michael@orlitzky.com>
Wed, 25 Nov 2020 04:26:39 +0000 (23:26 -0500)
mjo/eja/eja_algebra.py

index c569098b3d3e5d6fbceef6352e22861dd125a7f8..21718ee85e168d9ead63b061a3d623cb3ab6c8cc 100644 (file)
@@ -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()