def _cis(self, series_ring, base_ring):
        r"""
        The cycle index series for the species of partitions is given by

        .. math::

             exp \sum_{n \ge 1} \frac{1}{n} \left( exp \left( \sum_{k \ge 1} \frac{x_{kn}}{k} \right) -1 \right).



        EXAMPLES::

            sage: P = species.PartitionSpecies()
            sage: g = P.cycle_index_series()
            sage: g.coefficients(5)
            [p[],
             p[1],
             p[1, 1] + p[2],
             5/6*p[1, 1, 1] + 3/2*p[2, 1] + 2/3*p[3],
             5/8*p[1, 1, 1, 1] + 7/4*p[2, 1, 1] + 7/8*p[2, 2] + p[3, 1] + 3/4*p[4]]
        """
        ciset = SetSpecies().cycle_index_series(base_ring)
        CIS = ciset.parent()
        res = CIS.sum_generator(((1 / n) * ciset).stretch(n)
                                for n in _integers_from(ZZ(1))).exponential()
        if self.is_weighted():
            res *= self._weight
        return res
示例#2
0
 def _cis(self, series_ring, base_ring):
     r"""
     The cycle index series for the species of partitions is given by
     
     .. math::
     
          exp \sum_{n \ge 1} \frac{1}{n} \left( exp \left( \sum_{k \ge 1} \frac{x_{kn}}{k} \right) -1 \right).
     
     
     
     EXAMPLES::
     
         sage: P = species.PartitionSpecies()
         sage: g = P.cycle_index_series()
         sage: g.coefficients(5)
         [p[],
          p[1],
          p[1, 1] + p[2],
          5/6*p[1, 1, 1] + 3/2*p[2, 1] + 2/3*p[3],
          5/8*p[1, 1, 1, 1] + 7/4*p[2, 1, 1] + 7/8*p[2, 2] + p[3, 1] + 3/4*p[4]]
     """
     ciset = SetSpecies().cycle_index_series(base_ring)
     CIS = ciset.parent()
     res = CIS.sum_generator(((1/n)*ciset).stretch(n) for n in _integers_from(ZZ(1))).exponential()
     if self.is_weighted():
         res *= self._weight
     return res
示例#3
0
    def _cis(self, series_ring, base_ring):
        r"""
        The cycle index series for the species of partitions is given by

        .. math::

             exp \sum_{n \ge 1} \frac{1}{n} \left( exp \left( \sum_{k \ge 1} \frac{x_{kn}}{k} \right) -1 \right).



        EXAMPLES::

            sage: P = species.PartitionSpecies()
            sage: g = P.cycle_index_series()
            sage: g.coefficients(5)
            [p[],
             p[1],
             p[1, 1] + p[2],
             5/6*p[1, 1, 1] + 3/2*p[2, 1] + 2/3*p[3],
             5/8*p[1, 1, 1, 1] + 7/4*p[2, 1, 1] + 7/8*p[2, 2] + p[3, 1] + 3/4*p[4]]
        """
        ciset = SetSpecies().cycle_index_series(base_ring)
        res = ciset.composition(ciset - 1)
        if self.is_weighted():
            res *= self._weight
        return res
示例#4
0
    def _cis(self, series_ring, base_ring):
        r"""
        The cycle index series for the species of partitions is given by

        .. math::

             exp \sum_{n \ge 1} \frac{1}{n} \left( exp \left( \sum_{k \ge 1} \frac{x_{kn}}{k} \right) -1 \right).



        EXAMPLES::

            sage: P = species.PartitionSpecies()
            sage: g = P.cycle_index_series()
            sage: g.coefficients(5)
            [p[],
             p[1],
             p[1, 1] + p[2],
             5/6*p[1, 1, 1] + 3/2*p[2, 1] + 2/3*p[3],
             5/8*p[1, 1, 1, 1] + 7/4*p[2, 1, 1] + 7/8*p[2, 2] + p[3, 1] + 3/4*p[4]]
        """
        ciset = SetSpecies().cycle_index_series(base_ring)
        res = ciset.composition(ciset - 1)
        if self.is_weighted():
            res *= self._weight
        return res
示例#5
0
def SimpleGraphSpecies():
    """
    Returns the species of simple graphs.

    EXAMPLES::

        sage: S = species.SimpleGraphSpecies()
        sage: S.generating_series().counts(10)
        [1, 1, 2, 8, 64, 1024, 32768, 2097152, 268435456, 68719476736]
        sage: S.cycle_index_series().coefficients(5)
        [p[],
         p[1],
         p[1, 1] + p[2],
         4/3*p[1, 1, 1] + 2*p[2, 1] + 2/3*p[3],
         8/3*p[1, 1, 1, 1] + 4*p[2, 1, 1] + 2*p[2, 2] + 4/3*p[3, 1] + p[4]]
        sage: S.isotype_generating_series().coefficients(6)
        [1, 1, 2, 4, 11, 34]

    TESTS::

        sage: seq = S.isotype_generating_series().counts(6)[1:]
        sage: oeis(seq)[0]                              # optional -- internet
        A000088: Number of graphs on n unlabeled nodes.

    ::

        sage: seq = S.generating_series().counts(10)[1:]
        sage: oeis(seq)[0]                              # optional -- internet
        A006125: a(n) = 2^(n(n-1)/2).
    """
    E = SetSpecies()
    E2 = SetSpecies(size=2)
    WP = SubsetSpecies()
    P2 = E2 * E
    return WP.functorial_composition(P2)
    def _cis_term(self, base_ring):
        """
        EXAMPLES::

            sage: F = species.CharacteristicSpecies(2)
            sage: g = F.cycle_index_series()
            sage: g.coefficients(5)
            [0, 0, 1/2*p[1, 1] + 1/2*p[2], 0, 0]
        """
        cis = SetSpecies(weight=self._weight).cycle_index_series(base_ring)
        return cis.coefficient(self._n)
示例#7
0
def BinaryForestSpecies():
    """
    Returns the species of binary forests. Binary forests are defined
    as sets of binary trees.

    EXAMPLES::

        sage: F = species.BinaryForestSpecies()
        sage: F.generating_series().counts(10)
        [1, 1, 3, 19, 193, 2721, 49171, 1084483, 28245729, 848456353]
        sage: F.isotype_generating_series().counts(10)
        [1, 1, 2, 4, 10, 26, 77, 235, 758, 2504]
        sage: F.cycle_index_series().coefficients(7)
        [p[],
         p[1],
         3/2*p[1, 1] + 1/2*p[2],
         19/6*p[1, 1, 1] + 1/2*p[2, 1] + 1/3*p[3],
         193/24*p[1, 1, 1, 1] + 3/4*p[2, 1, 1] + 5/8*p[2, 2] + 1/3*p[3, 1] + 1/4*p[4],
         907/40*p[1, 1, 1, 1, 1] + 19/12*p[2, 1, 1, 1] + 5/8*p[2, 2, 1] + 1/2*p[3, 1, 1] + 1/6*p[3, 2] + 1/4*p[4, 1] + 1/5*p[5],
         49171/720*p[1, 1, 1, 1, 1, 1] + 193/48*p[2, 1, 1, 1, 1] + 15/16*p[2, 2, 1, 1] + 61/48*p[2, 2, 2] + 19/18*p[3, 1, 1, 1] + 1/6*p[3, 2, 1] + 7/18*p[3, 3] + 3/8*p[4, 1, 1] + 1/8*p[4, 2] + 1/5*p[5, 1] + 1/6*p[6]]

    TESTS::

        sage: seq = F.isotype_generating_series().counts(10)[1:] #optional
        sage: number, name, sseq = sloane_find(seq)[0]                    #optional
        sage: print number, name                                          #optional
        52854 Number of unordered forests on n nodes.
    """
    B = BinaryTreeSpecies()
    S = SetSpecies()
    F = S(B)
    return F
示例#8
0
    def _cis(self, series_ring, base_ring):
        r"""
        The cycle index series for the species of subsets satisfies

        .. math::

             Z_{\mathfrak{p}} = Z_{\mathcal{E}} \cdot Z_{\mathcal{E}}


        EXAMPLES::

            sage: S = species.SubsetSpecies()
            sage: S.cycle_index_series().coefficients(5)
            [p[],
             2*p[1],
             2*p[1, 1] + p[2],
             4/3*p[1, 1, 1] + 2*p[2, 1] + 2/3*p[3],
             2/3*p[1, 1, 1, 1] + 2*p[2, 1, 1] + 1/2*p[2, 2] + 4/3*p[3, 1] + 1/2*p[4]]
        """
        ciset = SetSpecies().cycle_index_series(base_ring)
        res = ciset**2
        if self.is_weighted():
            res *= self._weight
        return res