### Navigation

- index
- modules |
- next |
- previous |
- Combinatorics »
- Combinatorial Species »

# 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

  TESTS:

      sage: A = species.SingletonSpecies() + species.SingletonSpecies()
      sage: B = species.SingletonSpecies() + species.SingletonSpecies()
      sage: C = species.SingletonSpecies() + species.SingletonSpecies(min=2)
      sage: A is B
      True
      sage: (A is C) or (A == C)
      False

  `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`

  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`

### Navigation

- index
- modules |
- next |
- previous |
- Combinatorics »
- Combinatorial Species »