@@ -4745,20 +4745,24 @@ def functorial_composition(self, *args):
4745
4745
sage: h = SymmetricFunctions(QQ).h()
4746
4746
sage: e = SymmetricFunctions(QQ).e()
4747
4747
sage: L = LazySymmetricFunctions(h)
4748
- sage: E = L(lambda n: h[n])
4749
- sage: Ep = p[1]*E .derivative_with_respect_to_p1(); Ep
4748
+ sage: H = L(lambda n: h[n])
4749
+ sage: Ep = p[1]*H .derivative_with_respect_to_p1(); Ep
4750
4750
h[1] + (h[1,1]) + (h[2,1]) + (h[3,1]) + (h[4,1]) + (h[5,1]) + O^7
4751
4751
sage: f = L(lambda n: h[n-n//2, n//2])
4752
4752
sage: f - Ep.functorial_composition(f)
4753
4753
O^7
4754
4754
4755
+ The symmetric function `\sum_n h_n` is a left absorbing element::
4756
+
4757
+ sage: H.functorial_composition(f) - H
4758
+ O^7
4759
+
4755
4760
The functorial composition distributes over the sum::
4756
4761
4757
- sage: F1 = L(lambda n: h[n])
4758
- sage: F2 = L(lambda n: e[n])
4759
- sage: f1 = F1.functorial_composition(f)
4760
- sage: f2 = F2.functorial_composition(f)
4761
- sage: (F1 + F2).functorial_composition(f) - f1 - f2
4762
+ sage: E = L(lambda n: e[n])
4763
+ sage: f1 = H.functorial_composition(f)
4764
+ sage: f2 = E.functorial_composition(f)
4765
+ sage: (H + E).functorial_composition(f) - f1 - f2
4762
4766
O^7
4763
4767
4764
4768
TESTS:
@@ -4781,6 +4785,12 @@ def functorial_composition(self, *args):
4781
4785
Traceback (most recent call last):
4782
4786
...
4783
4787
ValueError: the argument is not the Frobenius character of a permutation representation
4788
+
4789
+ sage: g = -p[1, 1, 1]
4790
+ sage: r = f.functorial_composition(g); r[3]
4791
+ Traceback (most recent call last):
4792
+ ...
4793
+ ValueError: the argument is not the Frobenius character of a permutation representation
4784
4794
"""
4785
4795
if len (args ) != self .parent ()._arity :
4786
4796
raise ValueError ("arity must be equal to the number of arguments provided" )
@@ -4813,21 +4823,24 @@ def g_cycle_type(s, n):
4813
4823
if g [0 ]:
4814
4824
return Partition ([1 ]* ZZ (g [0 ].coefficient ([])))
4815
4825
return Partition ([])
4826
+
4827
+ g_n = g [n ]
4828
+ if not g_n :
4829
+ return Partition ([])
4830
+ if any (c < 0 for c in g_n .monomial_coefficients (copy = False ).values ()):
4831
+ raise ValueError ("the argument is not the Frobenius character of a permutation representation" )
4816
4832
res = []
4817
- # in the species case, k is at most
4818
- # factorial(n) * g[n].coefficient([1]*n)
4819
- for k in range (1 , lcm (s ) + 1 ):
4833
+ # k is the length of a cycle in G[sigma], and
4834
+ # n! g_n([1]*n) is the number of elements in G[n]
4835
+ for k in range (1 , 1 + min (lcm (s ),
4836
+ ZZ (factorial (n ) * g_n .coefficient ([1 ]* n )))):
4820
4837
e = 0
4821
4838
for d in divisors (k ):
4822
4839
m = moebius (d )
4823
4840
if not m :
4824
4841
continue
4825
4842
u = s .power (k // d )
4826
- # it could be, that we never need to compute
4827
- # g[n], so we only do this here
4828
- g_u = g [n ]
4829
- if g_u :
4830
- e += m * u .aut () * g_u .coefficient (u )
4843
+ e += m * u .aut () * g_n .coefficient (u )
4831
4844
# e / k might not be an integer if g is not a
4832
4845
# group action, so it is good to check
4833
4846
res .extend ([k ] * ZZ (e / k ))
0 commit comments