Recursive Species

class sage.combinat.species.recursive_species.CombinatorialSpecies

Bases: sage.combinat.species.species.GenericCombinatorialSpecies

define(x)

Defines self to be equal to the combinatorial species x. This is used to define combinatorial species recursively. All of the real work is done by calling the .set() method for each of the series associated to self.

EXAMPLES: The species of linear orders L can be recursively defined by L = 1 + X*L where 1 represents the empty set species and X represents the singleton species.

sage: X = species.SingletonSpecies()
sage: E = species.EmptySetSpecies()
sage: L = CombinatorialSpecies()
sage: L.define(E+X*L)
sage: L.generating_series().coefficients(4)
[1, 1, 1, 1]
sage: L.structures([1,2,3]).cardinality()
6
sage: L.structures([1,2,3]).list()
[1*(2*(3*{})),
 1*(3*(2*{})),
 2*(1*(3*{})),
 2*(3*(1*{})),
 3*(1*(2*{})),
 3*(2*(1*{}))]
sage: L = species.LinearOrderSpecies()
sage: L.generating_series().coefficients(4)
[1, 1, 1, 1]
sage: L.structures([1,2,3]).cardinality()
6
sage: L.structures([1,2,3]).list()
[[1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]]

TESTS:

sage: A = CombinatorialSpecies()
sage: A.define(E+X*A*A)
sage: A.generating_series().coefficients(6)
[1, 1, 2, 5, 14, 42]
sage: A.generating_series().counts(6)
[1, 1, 4, 30, 336, 5040]
sage: len(A.structures([1,2,3,4]).list())
336
sage: A.isotype_generating_series().coefficients(6)
[1, 1, 2, 5, 14, 42]
sage: len(A.isotypes([1,2,3,4]).list())
14
sage: A = CombinatorialSpecies()
sage: A.define(X+A*A)
sage: A.generating_series().coefficients(6)
[0, 1, 1, 2, 5, 14]
sage: A.generating_series().counts(6)
[0, 1, 2, 12, 120, 1680]
sage: len(A.structures([1,2,3]).list())
12
sage: A.isotype_generating_series().coefficients(6)
[0, 1, 1, 2, 5, 14]
sage: len(A.isotypes([1,2,3,4]).list())
5
sage: X2 = X*X
sage: X5 = X2*X2*X
sage: A = CombinatorialSpecies()
sage: B = CombinatorialSpecies()
sage: C = CombinatorialSpecies()
sage: A.define(X5+B*B)
sage: B.define(X5+C*C)
sage: C.define(X2+C*C+A*A)
sage: A.generating_series().coefficients(Integer(10))
[0, 0, 0, 0, 0, 1, 0, 0, 1, 2]
sage: A.generating_series().coefficients(15)
[0, 0, 0, 0, 0, 1, 0, 0, 1, 2, 5, 4, 14, 10, 48]
sage: B.generating_series().coefficients(15)
[0, 0, 0, 0, 1, 1, 2, 0, 5, 0, 14, 0, 44, 0, 138]
sage: C.generating_series().coefficients(15)
[0, 0, 1, 0, 1, 0, 2, 0, 5, 0, 15, 0, 44, 2, 142]
sage: F = CombinatorialSpecies()
sage: F.define(E+X+(X*F+X*X*F))
sage: F.generating_series().counts(10)
[1, 2, 6, 30, 192, 1560, 15120, 171360, 2217600, 32296320]
sage: F.generating_series().coefficients(10)
[1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
sage: F.isotype_generating_series().coefficients(10)
[1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
weight_ring()

EXAMPLES:

sage: F = species.CombinatorialSpecies()
sage: F.weight_ring()
Rational Field
sage: X = species.SingletonSpecies()
sage: E = species.EmptySetSpecies()
sage: L = CombinatorialSpecies()
sage: L.define(E+X*L)
sage: L.weight_ring()
Rational Field
class sage.combinat.species.recursive_species.CombinatorialSpeciesStructure(parent, s, **options)
Bases: sage.combinat.species.structure.SpeciesStructureWrapper

Previous topic

Empty Species

Next topic

Characteristic Species

This Page