From a2e9ed7c483e13980dd2849ca25c59e6995ca72c Mon Sep 17 00:00:00 2001 From: Travis Scrimshaw Date: Tue, 30 Aug 2022 10:24:22 +0900 Subject: [PATCH] Making the test for coercion of plethysms wrt tesnor products more robust. --- src/sage/combinat/sf/sfa.py | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/sage/combinat/sf/sfa.py b/src/sage/combinat/sf/sfa.py index 8abee9b6b3b..c573d2399c7 100644 --- a/src/sage/combinat/sf/sfa.py +++ b/src/sage/combinat/sf/sfa.py @@ -3127,9 +3127,19 @@ def plethysm(self, x, include=None, exclude=None): sage: p[2,2,1](2) 8*p[] + sage: p[2,2,1](int(2)) + 8*p[] + sage: p[2,2,1](a1) a1^5*p[] + sage: X = algebras.Shuffle(QQ, 'ab') + sage: Y = algebras.Shuffle(QQ, 'bc') + sage: T = tensor([X,Y]) + sage: s = SymmetricFunctions(T).s() + sage: s(2*T.one()) + (2*B[word:]#B[word:])*s[] + .. TODO:: The implementation of plethysm in @@ -3145,8 +3155,11 @@ def plethysm(self, x, include=None, exclude=None): from sage.structure.element import parent as get_parent Px = get_parent(x) tensorflag = Px in tHA - if not tensorflag and Px is not R: - if not is_SymmetricFunction(x): + if not is_SymmetricFunction(x): + if Px is R: # Handle stuff that is directly in the base ring + x = parent(x) + elif (not tensorflag or any(not isinstance(factor, SymmetricFunctionAlgebra_generic) + for factor in Px._sets)): from sage.rings.lazy_series import LazySymmetricFunction if isinstance(x, LazySymmetricFunction): from sage.rings.lazy_series_ring import LazySymmetricFunctions @@ -3155,11 +3168,12 @@ def plethysm(self, x, include=None, exclude=None): # Try to coerce into a symmetric function phi = parent.coerce_map_from(Px) - if phi is None: + if phi is not None: + x = phi(x) + elif not tensorflag: raise TypeError("only know how to compute plethysms " "between symmetric functions or tensors " "of symmetric functions") - x = phi(x) p = parent.realization_of().power()