@@ -4656,12 +4656,14 @@ def derivative_with_respect_to_p1(self, n=1):
4656
4656
return P .element_class (P , coeff_stream )
4657
4657
4658
4658
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``.
4660
4661
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`.
4665
4667
4666
4668
It can be shown (as in section 2.2 of [BLL]_) that there is a
4667
4669
corresponding operation on cycle indices:
@@ -4675,6 +4677,12 @@ def functorial_composition(self, *args):
4675
4677
4676
4678
This method implements that operation on cycle index series.
4677
4679
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
+
4678
4686
EXAMPLES:
4679
4687
4680
4688
The species `G` of simple graphs can be expressed in terms of a functorial
@@ -4724,11 +4732,10 @@ def functorial_composition(self, *args):
4724
4732
4725
4733
Check a corner case::
4726
4734
4735
+ sage: h = SymmetricFunctions(QQ).h()
4727
4736
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
4732
4739
4733
4740
"""
4734
4741
if len (args ) != self .parent ()._arity :
@@ -4749,9 +4756,11 @@ def functorial_composition(self, *args):
4749
4756
f = Stream_map_coefficients (self ._coeff_stream , lambda x : x , p )
4750
4757
4751
4758
def g_cycle_type (s ):
4759
+ # the cycle type of G[sigma] of any permutation sigma
4760
+ # with cycle type s
4752
4761
if not s :
4753
4762
if g [0 ]:
4754
- return Partition ([ZZ (g [0 ].coefficient ([]))] )
4763
+ return Partition ([1 ] * ZZ (g [0 ].coefficient ([])))
4755
4764
return Partition ([])
4756
4765
res = []
4757
4766
# in the species case, k is at most
@@ -4774,8 +4783,10 @@ def coefficient(n):
4774
4783
res = p (0 )
4775
4784
for s in Partitions (n ):
4776
4785
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 )
4779
4790
return res
4780
4791
4781
4792
coeff_stream = Stream_function (coefficient , R , P ._sparse , 0 )
0 commit comments