Пример #1
0
    def _b_power_k(self, k):
        r"""
        An expression involving moebius inversion in the powersum generators.

        For a positive value of ``k``, this expression is

        .. MATH::

            \frac{1}{k} \sum_{d|k} \mu(d/k) p_d.

        INPUT:

        - ``k`` -- a positive integer

        OUTPUT:

        - an expression in the powersum basis of the symmetric functions

        EXAMPLES::

            sage: st = SymmetricFunctions(QQ).st()
            sage: st._b_power_k(1)
            p[1]
            sage: st._b_power_k(2)
            -1/2*p[1] + 1/2*p[2]
            sage: st._b_power_k(6)
            1/6*p[1] - 1/6*p[2] - 1/6*p[3] + 1/6*p[6]

        """
        if k == 1:
            return self._p([1])
        if k > 0:
            return ~k * self._p.sum(moebius(k/d)*self._p([d])
                                    for d in divisors(k))
Пример #2
0
def primitives(n, invertible=False, q=None):
    """
    Return the number of similarity classes of simple matrices
    of order n with entries in a finite field of order ``q``.
    This is the same as the number of irreducible polynomials
    of degree d.

    If ``invertible`` is ``True``, then only the number of
    similarity classes of invertible matrices is returned.

    .. NOTE::

        All primitive classes are invertible unless ``n`` is `1`.

    INPUT:

    - ``n`` -- a positive integer

    - ``invertible`` -- boolean; if set, only number of non-zero classes is returned

    - ``q`` -- an integer or an indeterminate

    OUTPUT:

    - a rational function of the variable ``q``

    EXAMPLES::

        sage: from sage.combinat.similarity_class_type import primitives
        sage: primitives(1)
        q
        sage: primitives(1, invertible = True)
        q - 1
        sage: primitives(4)
        1/4*q^4 - 1/4*q^2
        sage: primitives(4, invertible = True)
        1/4*q^4 - 1/4*q^2
    """
    if q is None:
        q = QQ["q"].gen()
    p = sum([moebius(n / d) * q ** d for d in divisors(n)]) / n
    if invertible and n == 1:
        return p - 1
    else:
        return p
Пример #3
0
def primitives(n, invertible=False, q=None):
    """
    Return the number of similarity classes of simple matrices
    of order n with entries in a finite field of order ``q``.
    This is the same as the number of irreducible polynomials
    of degree d.

    If ``invertible`` is ``True``, then only the number of
    similarity classes of invertible matrices is returned.

    .. NOTE::

        All primitive classes are invertible unless ``n`` is `1`.

    INPUT:

    - ``n`` -- a positive integer

    - ``invertible`` -- boolean; if set, only number of non-zero classes is returned

    - ``q`` -- an integer or an indeterminate

    OUTPUT:

    - a rational function of the variable ``q``

    EXAMPLES::

        sage: from sage.combinat.similarity_class_type import primitives
        sage: primitives(1)
        q
        sage: primitives(1, invertible = True)
        q - 1
        sage: primitives(4)
        1/4*q^4 - 1/4*q^2
        sage: primitives(4, invertible = True)
        1/4*q^4 - 1/4*q^2
    """
    if q is None:
        q = QQ['q'].gen()
    p = sum([moebius(n / d) * q**d for d in divisors(n)]) / n
    if invertible and n == 1:
        return p - 1
    else:
        return p