@@ -5930,13 +5930,18 @@ def functorial_composition(self, *args):
5930
5930
sage: h = SymmetricFunctions(QQ).h()
5931
5931
sage: e = SymmetricFunctions(QQ).e()
5932
5932
sage: L = LazySymmetricFunctions(h)
5933
- sage: E = L(lambda n: h[n])
5934
- sage: Ep = p[1]*E .derivative_with_respect_to_p1(); Ep
5933
+ sage: H = L(lambda n: h[n])
5934
+ sage: Ep = p[1]*H .derivative_with_respect_to_p1(); Ep
5935
5935
h[1] + (h[1,1]) + (h[2,1]) + (h[3,1]) + (h[4,1]) + (h[5,1]) + O^7
5936
5936
sage: f = L(lambda n: h[n-n//2, n//2])
5937
5937
sage: f - Ep.functorial_composition(f)
5938
5938
O^7
5939
5939
5940
+ The symmetric function `\sum_n h_n` is a left absorbing element::
5941
+
5942
+ sage: H.functorial_composition(f) - H
5943
+ O^7
5944
+
5940
5945
The functorial composition distributes over the sum::
5941
5946
5942
5947
sage: F1 = L(lambda n: h[n])
@@ -5966,7 +5971,11 @@ def functorial_composition(self, *args):
5966
5971
Traceback (most recent call last):
5967
5972
...
5968
5973
ValueError: the argument is not the Frobenius character of a permutation representation
5969
-
5974
+ sage: g = -p[1, 1, 1]
5975
+ sage: r = f.functorial_composition(g); r[3]
5976
+ Traceback (most recent call last):
5977
+ ...
5978
+ ValueError: the argument is not the Frobenius character of a permutation representation
5970
5979
"""
5971
5980
if len (args ) != self .parent ()._arity :
5972
5981
raise ValueError ("arity must be equal to the number of arguments provided" )
@@ -5999,21 +6008,24 @@ def g_cycle_type(s, n):
5999
6008
if g [0 ]:
6000
6009
return Partition ([1 ]* ZZ (g [0 ].coefficient ([])))
6001
6010
return Partition ([])
6011
+
6012
+ g_n = g [n ]
6013
+ if not g_n :
6014
+ return Partition ([])
6015
+ if any (c < 0 for c in g_n .monomial_coefficients (copy = False ).values ()):
6016
+ raise ValueError ("the argument is not the Frobenius character of a permutation representation" )
6002
6017
res = []
6003
- # in the species case, k is at most
6004
- # factorial(n) * g[n].coefficient([1]*n)
6005
- for k in range (1 , lcm (s ) + 1 ):
6018
+ # k is the length of a cycle in G[sigma], and
6019
+ # n! g_n([1]*n) is the number of elements in G[n]
6020
+ for k in range (1 , 1 + min (lcm (s ),
6021
+ ZZ (factorial (n ) * g_n .coefficient ([1 ]* n )))):
6006
6022
e = 0
6007
6023
for d in divisors (k ):
6008
6024
m = moebius (d )
6009
6025
if not m :
6010
6026
continue
6011
6027
u = s .power (k // d )
6012
- # it could be, that we never need to compute
6013
- # g[n], so we only do this here
6014
- g_u = g [n ]
6015
- if g_u :
6016
- e += m * u .aut () * g_u .coefficient (u )
6028
+ e += m * u .aut () * g_n .coefficient (u )
6017
6029
# e / k might not be an integer if g is not a
6018
6030
# group action, so it is good to check
6019
6031
res .extend ([k ] * ZZ (e / k ))
0 commit comments