Skip to content

Commit 9fd2545

Browse files
committed
polish g_cycle_type, add a test and an example
1 parent 04232a4 commit 9fd2545

File tree

1 file changed

+23
-11
lines changed

1 file changed

+23
-11
lines changed

src/sage/rings/lazy_series.py

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5930,13 +5930,18 @@ def functorial_composition(self, *args):
59305930
sage: h = SymmetricFunctions(QQ).h()
59315931
sage: e = SymmetricFunctions(QQ).e()
59325932
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
59355935
h[1] + (h[1,1]) + (h[2,1]) + (h[3,1]) + (h[4,1]) + (h[5,1]) + O^7
59365936
sage: f = L(lambda n: h[n-n//2, n//2])
59375937
sage: f - Ep.functorial_composition(f)
59385938
O^7
59395939
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+
59405945
The functorial composition distributes over the sum::
59415946
59425947
sage: F1 = L(lambda n: h[n])
@@ -5966,7 +5971,11 @@ def functorial_composition(self, *args):
59665971
Traceback (most recent call last):
59675972
...
59685973
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
59705979
"""
59715980
if len(args) != self.parent()._arity:
59725981
raise ValueError("arity must be equal to the number of arguments provided")
@@ -5999,21 +6008,24 @@ def g_cycle_type(s, n):
59996008
if g[0]:
60006009
return Partition([1]*ZZ(g[0].coefficient([])))
60016010
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")
60026017
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)))):
60066022
e = 0
60076023
for d in divisors(k):
60086024
m = moebius(d)
60096025
if not m:
60106026
continue
60116027
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)
60176029
# e / k might not be an integer if g is not a
60186030
# group action, so it is good to check
60196031
res.extend([k] * ZZ(e / k))

0 commit comments

Comments
 (0)