Skip to content

Commit 29c6545

Browse files
committed
return correct partition in g_cycle_type, add documentation
1 parent e383a01 commit 29c6545

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

src/sage/rings/lazy_series.py

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4656,12 +4656,14 @@ def derivative_with_respect_to_p1(self, n=1):
46564656
return P.element_class(P, coeff_stream)
46574657

46584658
def functorial_composition(self, *args):
4659-
r"""Return the functorial composition of ``self`` and ``g``.
4659+
r"""
4660+
Return the functorial composition of ``self`` and ``g``.
46604661
4661-
If `F` and `G` are species, their functorial composition is the species
4662-
`F \Box G` obtained by setting `(F \Box G) [A] = F[ G[A] ]`.
4663-
In other words, an `(F \Box G)`-structure on a set `A` of labels is an
4664-
`F`-structure whose labels are the set of all `G`-structures on `A`.
4662+
If `F` and `G` are species, their functorial composition is
4663+
the species `F \Box G` obtained by setting `(F \Box G) [A] =
4664+
F[ G[A] ]`. In other words, an `(F \Box G)`-structure on a
4665+
set `A` of labels is an `F`-structure whose labels are the
4666+
set of all `G`-structures on `A`.
46654667
46664668
It can be shown (as in section 2.2 of [BLL]_) that there is a
46674669
corresponding operation on cycle indices:
@@ -4675,6 +4677,12 @@ def functorial_composition(self, *args):
46754677
46764678
This method implements that operation on cycle index series.
46774679
4680+
.. WARNING::
4681+
4682+
The operation `f \Box g` only makes sense when `g`
4683+
corresponds to a permutation representation, i.e., a
4684+
group action.
4685+
46784686
EXAMPLES:
46794687
46804688
The species `G` of simple graphs can be expressed in terms of a functorial
@@ -4724,11 +4732,10 @@ def functorial_composition(self, *args):
47244732
47254733
Check a corner case::
47264734
4735+
sage: h = SymmetricFunctions(QQ).h()
47274736
sage: L = LazySymmetricFunctions(h)
4728-
sage: Ep = L(lambda n: h[n-1]*h[1], valuation=1); Ep
4729-
h[1] + (h[1,1]) + (h[2,1]) + (h[3,1]) + (h[4,1]) + (h[5,1]) + (h[6,1]) + O^8
4730-
sage: Ep.functorial_composition(L([3*h[0]]))
4731-
3*h[]
4737+
sage: L(h[2,1]).functorial_composition(L([3*h[0]]))
4738+
3*h[] + O^7
47324739
47334740
"""
47344741
if len(args) != self.parent()._arity:
@@ -4749,9 +4756,11 @@ def functorial_composition(self, *args):
47494756
f = Stream_map_coefficients(self._coeff_stream, lambda x: x, p)
47504757

47514758
def g_cycle_type(s):
4759+
# the cycle type of G[sigma] of any permutation sigma
4760+
# with cycle type s
47524761
if not s:
47534762
if g[0]:
4754-
return Partition([ZZ(g[0].coefficient([]))])
4763+
return Partition([1]*ZZ(g[0].coefficient([])))
47554764
return Partition([])
47564765
res = []
47574766
# in the species case, k is at most
@@ -4774,8 +4783,10 @@ def coefficient(n):
47744783
res = p(0)
47754784
for s in Partitions(n):
47764785
t = g_cycle_type(s)
4777-
q = t.aut() * f[t.size()].coefficient(t) / s.aut()
4778-
res += q * p(s)
4786+
f_t = f[t.size()]
4787+
if f_t:
4788+
q = t.aut() * f_t.coefficient(t) / s.aut()
4789+
res += q * p(s)
47794790
return res
47804791

47814792
coeff_stream = Stream_function(coefficient, R, P._sparse, 0)

0 commit comments

Comments
 (0)