Skip to content

Commit a2e9ed7

Browse files
committed
Making the test for coercion of plethysms wrt tesnor products more robust.
1 parent 5f21f3d commit a2e9ed7

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

src/sage/combinat/sf/sfa.py

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3127,9 +3127,19 @@ def plethysm(self, x, include=None, exclude=None):
31273127
sage: p[2,2,1](2)
31283128
8*p[]
31293129
3130+
sage: p[2,2,1](int(2))
3131+
8*p[]
3132+
31303133
sage: p[2,2,1](a1)
31313134
a1^5*p[]
31323135
3136+
sage: X = algebras.Shuffle(QQ, 'ab')
3137+
sage: Y = algebras.Shuffle(QQ, 'bc')
3138+
sage: T = tensor([X,Y])
3139+
sage: s = SymmetricFunctions(T).s()
3140+
sage: s(2*T.one())
3141+
(2*B[word:]#B[word:])*s[]
3142+
31333143
.. TODO::
31343144
31353145
The implementation of plethysm in
@@ -3145,8 +3155,11 @@ def plethysm(self, x, include=None, exclude=None):
31453155
from sage.structure.element import parent as get_parent
31463156
Px = get_parent(x)
31473157
tensorflag = Px in tHA
3148-
if not tensorflag and Px is not R:
3149-
if not is_SymmetricFunction(x):
3158+
if not is_SymmetricFunction(x):
3159+
if Px is R: # Handle stuff that is directly in the base ring
3160+
x = parent(x)
3161+
elif (not tensorflag or any(not isinstance(factor, SymmetricFunctionAlgebra_generic)
3162+
for factor in Px._sets)):
31503163
from sage.rings.lazy_series import LazySymmetricFunction
31513164
if isinstance(x, LazySymmetricFunction):
31523165
from sage.rings.lazy_series_ring import LazySymmetricFunctions
@@ -3155,11 +3168,12 @@ def plethysm(self, x, include=None, exclude=None):
31553168

31563169
# Try to coerce into a symmetric function
31573170
phi = parent.coerce_map_from(Px)
3158-
if phi is None:
3171+
if phi is not None:
3172+
x = phi(x)
3173+
elif not tensorflag:
31593174
raise TypeError("only know how to compute plethysms "
31603175
"between symmetric functions or tensors "
31613176
"of symmetric functions")
3162-
x = phi(x)
31633177

31643178
p = parent.realization_of().power()
31653179

0 commit comments

Comments
 (0)