Sum species

class sage.combinat.species.sum_species.SumSpecies(F, G, min=None, max=None, weight=None)

Bases: sage.combinat.species.species.GenericCombinatorialSpecies, sage.structure.unique_representation.UniqueRepresentation

Returns the sum of two species.

EXAMPLES:

sage: S = species.PermutationSpecies()
sage: A = S+S
sage: A.generating_series().coefficients(5)
[2, 2, 2, 2, 2]

sage: P = species.PermutationSpecies()
sage: F = P + P
sage: F._check()
True
sage: F == loads(dumps(F))
True
left_summand()

Returns the left summand of this species.

EXAMPLES:

sage: P = species.PermutationSpecies()
sage: F = P + P*P
sage: F.left_summand()
Permutation species
right_summand()

Returns the right summand of this species.

EXAMPLES:

sage: P = species.PermutationSpecies()
sage: F = P + P*P
sage: F.right_summand()
Product of (Permutation species) and (Permutation species)
weight_ring()

Returns the weight ring for this species. This is determined by asking Sage’s coercion model what the result is when you add elements of the weight rings for each of the operands.

EXAMPLES:

sage: S = species.SetSpecies()
sage: C = S+S
sage: C.weight_ring()
Rational Field
sage: S = species.SetSpecies(weight=QQ['t'].gen())
sage: C = S + S
sage: C.weight_ring()
Univariate Polynomial Ring in t over Rational Field
class sage.combinat.species.sum_species.SumSpeciesStructure(parent, s, **options)

Bases: sage.combinat.species.structure.SpeciesStructureWrapper

This is a class for the structures of species such as the sum species that do not provide “additional” structure. For example, if you have the sum \(C\) of species \(A\) and \(B\), then a structure of \(C\) will either be either something from \(A\) or \(B\). Instead of just returning one of these directly, a “wrapper” is put around them so that they have their parent is \(C\) rather than \(A\) or \(B\):

sage: X = species.SingletonSpecies()
sage: X2 = X+X
sage: s = X2.structures([1]).random_element(); s
1
sage: s.parent()
Sum of (Singleton species) and (Singleton species)
sage: from sage.combinat.species.structure import SpeciesStructureWrapper
sage: issubclass(type(s), SpeciesStructureWrapper)
True

EXAMPLES:

sage: E = species.SetSpecies(); B = E+E
sage: s = B.structures([1,2,3]).random_element()
sage: s.parent()
Sum of (Set species) and (Set species)
sage: s == loads(dumps(s))
True
sage.combinat.species.sum_species.SumSpecies_class

alias of SumSpecies