@@ -3073,6 +3073,31 @@ def plethysm(self, x, include=None, exclude=None):
3073
3073
sage: sum(s[mu](X)*s[mu.conjugate()](Y) for mu in P5) == sum(m[mu](X)*e[mu](Y) for mu in P5)
3074
3074
True
3075
3075
3076
+ Sage can also do the plethysm with an element in the completion::
3077
+
3078
+ sage: L = LazySymmetricFunctions(s)
3079
+ sage: f = s[2,1]
3080
+ sage: g = L(s[1]) / (1 - L(s[1])); g
3081
+ s[1] + (s[1,1]+s[2]) + (s[1,1,1]+2*s[2,1]+s[3])
3082
+ + (s[1,1,1,1]+3*s[2,1,1]+2*s[2,2]+3*s[3,1]+s[4])
3083
+ + (s[1,1,1,1,1]+4*s[2,1,1,1]+5*s[2,2,1]+6*s[3,1,1]+5*s[3,2]+4*s[4,1]+s[5])
3084
+ + ... + O^8
3085
+ sage: fog = f(g)
3086
+ sage: fog[:8]
3087
+ [s[2, 1],
3088
+ s[1, 1, 1, 1] + 3*s[2, 1, 1] + 2*s[2, 2] + 3*s[3, 1] + s[4],
3089
+ 2*s[1, 1, 1, 1, 1] + 8*s[2, 1, 1, 1] + 10*s[2, 2, 1]
3090
+ + 12*s[3, 1, 1] + 10*s[3, 2] + 8*s[4, 1] + 2*s[5],
3091
+ 3*s[1, 1, 1, 1, 1, 1] + 17*s[2, 1, 1, 1, 1] + 30*s[2, 2, 1, 1]
3092
+ + 16*s[2, 2, 2] + 33*s[3, 1, 1, 1] + 54*s[3, 2, 1] + 16*s[3, 3]
3093
+ + 33*s[4, 1, 1] + 30*s[4, 2] + 17*s[5, 1] + 3*s[6],
3094
+ 5*s[1, 1, 1, 1, 1, 1, 1] + 30*s[2, 1, 1, 1, 1, 1] + 70*s[2, 2, 1, 1, 1]
3095
+ + 70*s[2, 2, 2, 1] + 75*s[3, 1, 1, 1, 1] + 175*s[3, 2, 1, 1]
3096
+ + 105*s[3, 2, 2] + 105*s[3, 3, 1] + 100*s[4, 1, 1, 1] + 175*s[4, 2, 1]
3097
+ + 70*s[4, 3] + 75*s[5, 1, 1] + 70*s[5, 2] + 30*s[6, 1] + 5*s[7]]
3098
+ sage: parent(fog)
3099
+ Lazy completion of Symmetric Functions over Rational Field in the Schur basis
3100
+
3076
3101
.. SEEALSO::
3077
3102
3078
3103
:meth:`frobenius`
@@ -3089,41 +3114,59 @@ def plethysm(self, x, include=None, exclude=None):
3089
3114
sage: f = a1*p[1] + a2*p[2] + a11*p[1,1]
3090
3115
sage: g = b1*p[1] + b21*p[2,1] + b111*p[1,1,1]
3091
3116
sage: r = f(g); r
3092
- a1*b1*p[1] + a11*b1^2*p[1, 1] + a1*b111*p[1, 1, 1] + 2*a11*b1*b111*p[1, 1, 1, 1] + a11*b111^2*p[1, 1, 1, 1, 1, 1] + a2*b1^2*p[2] + a1*b21*p[2, 1] + 2*a11*b1*b21*p[2, 1, 1] + 2*a11*b21*b111*p[2, 1, 1, 1, 1] + a11*b21^2*p[2, 2, 1, 1] + a2*b111^2*p[2, 2, 2] + a2*b21^2*p[4, 2]
3117
+ a1*b1*p[1] + a11*b1^2*p[1, 1] + a1*b111*p[1, 1, 1]
3118
+ + 2*a11*b1*b111*p[1, 1, 1, 1] + a11*b111^2*p[1, 1, 1, 1, 1, 1]
3119
+ + a2*b1^2*p[2] + a1*b21*p[2, 1] + 2*a11*b1*b21*p[2, 1, 1]
3120
+ + 2*a11*b21*b111*p[2, 1, 1, 1, 1] + a11*b21^2*p[2, 2, 1, 1]
3121
+ + a2*b111^2*p[2, 2, 2] + a2*b21^2*p[4, 2]
3093
3122
sage: r - f(g, include=[])
3094
3123
(a2*b1^2-a2*b1)*p[2] + (a2*b111^2-a2*b111)*p[2, 2, 2] + (a2*b21^2-a2*b21)*p[4, 2]
3095
3124
3096
3125
Check that we can compute the plethysm with a constant::
3097
3126
3098
3127
sage: p[2,2,1](2)
3099
- 8
3128
+ 8*p[]
3100
3129
3101
3130
sage: p[2,2,1](a1)
3102
- a1^5
3131
+ a1^5*p[]
3103
3132
3104
3133
.. TODO::
3105
3134
3106
3135
The implementation of plethysm in
3107
3136
:class:`sage.data_structures.stream.Stream_plethysm` seems
3108
3137
to be faster. This should be investigated.
3109
-
3110
3138
"""
3111
3139
parent = self .parent ()
3140
+ if not self :
3141
+ return self
3142
+
3112
3143
R = parent .base_ring ()
3113
3144
tHA = HopfAlgebrasWithBasis (R ).TensorProducts ()
3114
- tensorflag = tHA in x .parent ().categories ()
3115
- if not (is_SymmetricFunction (x ) or tensorflag ):
3116
- raise TypeError ("only know how to compute plethysms "
3117
- "between symmetric functions or tensors "
3118
- "of symmetric functions" )
3145
+ from sage .structure .element import parent as get_parent
3146
+ Px = get_parent (x )
3147
+ tensorflag = Px in tHA
3148
+ if not tensorflag and Px is not R :
3149
+ if not is_SymmetricFunction (x ):
3150
+ from sage .rings .lazy_series import LazySymmetricFunction
3151
+ if isinstance (x , LazySymmetricFunction ):
3152
+ from sage .rings .lazy_series_ring import LazySymmetricFunctions
3153
+ L = LazySymmetricFunctions (parent )
3154
+ return L (self )(x )
3155
+
3156
+ # Try to coerce into a symmetric function
3157
+ phi = parent .coerce_map_from (Px )
3158
+ if phi is None :
3159
+ raise TypeError ("only know how to compute plethysms "
3160
+ "between symmetric functions or tensors "
3161
+ "of symmetric functions" )
3162
+ x = phi (x )
3163
+
3119
3164
p = parent .realization_of ().power ()
3120
- if self == parent .zero ():
3121
- return self
3122
3165
3123
3166
degree_one = _variables_recursive (R , include = include , exclude = exclude )
3124
3167
3125
3168
if tensorflag :
3126
- tparents = x . parent () ._sets
3169
+ tparents = Px ._sets
3127
3170
s = sum (d * prod (sum (_raise_variables (c , r , degree_one )
3128
3171
* tensor ([p [r ].plethysm (base (la ))
3129
3172
for base , la in zip (tparents , trm )])
0 commit comments