From: Michael Orlitzky Date: Tue, 10 Nov 2020 13:39:25 +0000 (-0500) Subject: eja: fix base ring of fast _charpoly_coefficients(). X-Git-Url: http://gitweb.michael.orlitzky.com/?a=commitdiff_plain;h=220806a8c2d8f72a164e7b0c1ba4451999e0fce5;p=sage.d.git eja: fix base ring of fast _charpoly_coefficients(). --- diff --git a/mjo/eja/eja_algebra.py b/mjo/eja/eja_algebra.py index 1fc3618..e288c6c 100644 --- a/mjo/eja/eja_algebra.py +++ b/mjo/eja/eja_algebra.py @@ -1049,6 +1049,26 @@ class RationalBasisEuclideanJordanAlgebra(FiniteDimensionalEuclideanJordanAlgebr r""" Override the parent method with something that tries to compute over a faster (non-extension) field. + + SETUP:: + + sage: from mjo.eja.eja_algebra import JordanSpinEJA + + EXAMPLES: + + The base ring of the resulting polynomial coefficients is what + it should be, and not the rationals (unless the algebra was + already over the rationals):: + + sage: J = JordanSpinEJA(3) + sage: J._charpoly_coefficients() + (X1^2 - X2^2 - X3^2, -2*X1) + sage: a0 = J._charpoly_coefficients()[0] + sage: J.base_ring() + Algebraic Real Field + sage: a0.base_ring() + Algebraic Real Field + """ if self.base_ring() is QQ: # There's no need to construct *another* algebra over the @@ -1068,7 +1088,8 @@ class RationalBasisEuclideanJordanAlgebra(FiniteDimensionalEuclideanJordanAlgebr mult_table, check_field=False, check_axioms=False) - return J._charpoly_coefficients() + a = J._charpoly_coefficients() + return tuple(map(lambda x: x.change_ring(self.base_ring()), a)) class MatrixEuclideanJordanAlgebra(FiniteDimensionalEuclideanJordanAlgebra):