Beispiel #1
0
def symmetrized_coordinate_sums(dim, n):
    """
    Return formal symmetrized sum of multi-indices

    INPUT:

    - ``dim`` -- integer. The dimension (range of each index).

    - ``n`` -- integer. The total number of indices.

    OUTPUT:

    A symmetrized formal sum of multi-indices (tuples of integers)

    EXAMPLES::

        sage: from sage.modules.tensor_operations import symmetrized_coordinate_sums
        sage: symmetrized_coordinate_sums(2, 2)
        ((0, 1) + (1, 0), (0, 0), (1, 1))
    """
    from sage.structure.formal_sum import FormalSum
    coordinates = [range(dim) for i in range(n)]
    table = dict()
    from sage.categories.cartesian_product import cartesian_product
    for i in cartesian_product(coordinates):
        sort_i = tuple(sorted(i))
        x = table.get(sort_i, [])
        x.append([+1, tuple(i)])
        table[sort_i] = x
    return tuple(FormalSum(x) for x in table.values())
Beispiel #2
0
def antisymmetrized_coordinate_sums(dim, n):
    """
    Return formal anti-symmetrized sum of multi-indices

    INPUT:

    - ``dim`` -- integer. The dimension (range of each index).

    - ``n`` -- integer. The total number of indices.

    OUTPUT:

    An anti-symmetrized formal sum of multi-indices (tuples of integers)

    EXAMPLES::

        sage: from sage.modules.tensor_operations import antisymmetrized_coordinate_sums
        sage: antisymmetrized_coordinate_sums(3, 2)
        ((0, 1) - (1, 0), (0, 2) - (2, 0), (1, 2) - (2, 1))
    """
    from sage.structure.formal_sum import FormalSum
    table = []
    from sage.groups.perm_gps.permgroup_named import SymmetricGroup
    S_d = SymmetricGroup(n)
    from sage.combinat.combination import Combinations
    for i in Combinations(range(dim), n):
        i = tuple(i)
        x = []
        for g in S_d:
            x.append([g.sign(), g(i)])
        x = FormalSum(x)
        table.append(x)
    return tuple(table)
    def divisor(self):
        r"""
        Return the divisor of self, as a formal sum of CuspFamily objects.

        EXAMPLES::

            sage: e = EtaProduct(12, {1:-336, 2:576, 3:696, 4:-216, 6:-576, 12:-144})
            sage: e.divisor() # FormalSum seems to print things in a random order?
            -131*(Inf) - 50*(c_{2}) + 11*(0) + 50*(c_{6}) + 169*(c_{4}) - 49*(c_{3})
            sage: e = EtaProduct(2^8, {8:1,32:-1})
            sage: e.divisor() # random
            -(c_{2}) - (Inf) - (c_{8,2}) - (c_{8,3}) - (c_{8,4}) - (c_{4,2}) - (c_{8,1}) - (c_{4,1}) + (c_{32,4}) + (c_{32,3}) + (c_{64,1}) + (0) + (c_{32,2}) + (c_{64,2}) + (c_{128}) + (c_{32,1})
        """
        return FormalSum([ (self.order_at_cusp(c), c) for c in AllCusps(self.level())])
Beispiel #4
0
    def __init__(self, v, parent, check=True, reduce=True):
        r"""
        Construct a :class:`Divisor_generic`.

        INPUT:

        INPUT:

        - ``v`` -- object. Usually a list of pairs
          ``(coefficient,divisor)``.

        - ``parent`` -- FormalSums(R) module (default: FormalSums(ZZ))

        - ``check`` -- bool (default: True). Whether to coerce
          coefficients into base ring. Setting it to ``False`` can
          speed up construction.

        - ``reduce`` -- reduce (default: True). Whether to combine
          common terms. Setting it to ``False`` can speed up
          construction.

        .. WARNING::

            The coefficients of the divisor must be in the base ring
            and the terms must be reduced. If you set ``check=False``
            and/or ``reduce=False`` it is your responsibility to pass
            a valid object ``v``.

        EXAMPLES::

            sage: from sage.schemes.generic.divisor import Divisor_generic
            sage: from sage.schemes.generic.divisor_group import DivisorGroup
            sage: Divisor_generic( [(4,5)], DivisorGroup(Spec(ZZ)), False, False)
            4*V(5)
        """
        FormalSum.__init__(self, v, parent, check, reduce)
Beispiel #5
0
    def __init__(self, v, parent, check=True, reduce=True):
        r"""
        Construct a :class:`Divisor_generic`.

        INPUT:

        INPUT:

        - ``v`` -- object. Usually a list of pairs
          ``(coefficient,divisor)``.

        - ``parent`` -- FormalSums(R) module (default: FormalSums(ZZ))

        - ``check`` -- bool (default: True). Whether to coerce
          coefficients into base ring. Setting it to ``False`` can
          speed up construction.

        - ``reduce`` -- reduce (default: True). Whether to combine
          common terms. Setting it to ``False`` can speed up
          construction.

        .. WARNING::

            The coefficients of the divisor must be in the base ring
            and the terms must be reduced. If you set ``check=False``
            and/or ``reduce=False`` it is your responsibility to pass
            a valid object ``v``.

        EXAMPLES::

            sage: from sage.schemes.generic.divisor import Divisor_generic
            sage: from sage.schemes.generic.divisor_group import DivisorGroup
            sage: Divisor_generic( [(4,5)], DivisorGroup(Spec(ZZ)), False, False)
            4*V(5)
        """
        FormalSum.__init__(self, v, parent, check, reduce)
Beispiel #6
0
def local_basis(dop, point, order=None):
    r"""
    Generalized series expansions the local basis.

    INPUT:

    * dop - Differential operator

    * point - Point where the local basis is to be computed

    * order (optional) - Number of terms to compute, **starting from each
      “leftmost” valuation of a group of solutions with valuations differing by
      integers**. (Thus, the absolute truncation order will be the same for all
      solutions in such a group, with some solutions having more actual
      coefficients computed that others.)

      The default is to choose the truncation order in such a way that the
      structure of the basis is apparent, and in particular that logarithmic
      terms appear if logarithms are involved at all in that basis. The
      corresponding order may be very large in some cases.

    EXAMPLES::

        sage: from ore_algebra import *
        sage: from ore_algebra.analytic.local_solutions import local_basis
        sage: Dops, x, Dx = DifferentialOperators(QQ, 'x')

        sage: local_basis(Dx - 1, 0)
        [1 + x + 1/2*x^2 + 1/6*x^3]

        sage: from ore_algebra.analytic.examples import ssw
        sage: local_basis(ssw.dop3, 0)
        [t^(-4) + 24*log(t)/t^2 - 48*log(t) - 96*t^2*log(t) - 88*t^2,
         t^(-2),
         1 + 2*t^2]

        sage: dop = (x^2*(x^2-34*x+1)*Dx^3 + 3*x*(2*x^2-51*x+1)*Dx^2
        ....:     + (7*x^2-112*x+1)*Dx + (x-5))
        sage: local_basis(dop, 0, 3)
        [1/2*log(x)^2 + 5/2*x*log(x)^2 + 12*x*log(x) + 73/2*x^2*log(x)^2
         + 210*x^2*log(x) + 72*x^2,
         log(x) + 5*x*log(x) + 12*x + 73*x^2*log(x) + 210*x^2,
         1 + 5*x + 73*x^2]

        sage: roots = dop.leading_coefficient().roots(AA)
        sage: local_basis(dop, roots[1][0], 3)
        [1 - (-239/12*a+169/6)*(x + 12*sqrt(2) - 17)^2,
         sqrt(x + 12*sqrt(2) - 17) - (-203/32*a+9)*(x + 12*sqrt(2) - 17)^(3/2)
         + (-24031/160*a+1087523/5120)*(x + 12*sqrt(2) - 17)^(5/2),
         x + 12*sqrt(2) - 17 - (-55/6*a+13)*(x + 12*sqrt(2) - 17)^2]

    TESTS::

        sage: local_basis(4*x^2*Dx^2 + (-x^2+8*x-11), 0, 2)
        [x^(-sqrt(3) + 1/2) + (-4/11*a+2/11)*x^(-sqrt(3) + 3/2),
         x^(sqrt(3) + 1/2) - (-4/11*a-2/11)*x^(sqrt(3) + 3/2)]

        sage: local_basis((27*x^2+4*x)*Dx^2 + (54*x+6)*Dx + 6, 0, 2)
        [1/sqrt(x) + 3/8*sqrt(x), 1 - x]

    """
    from .path import Point
    point = Point(point, dop)
    ldop = point.local_diffop()
    if order is None:
        ind = ldop.indicial_polynomial(ldop.base_ring().gen())
        order = max(dop.order(), ind.dispersion()) + 3
    sols = map_local_basis(ldop,
                           lambda ini, bwrec: log_series(ini, bwrec, order),
                           lambda leftmost, shift: {})
    dx = SR(dop.base_ring().gen()) - point.value

    # Working with symbolic expressions here is too complicated: let's try
    # returning FormalSums.
    def log_monomial(expo, n, k):
        expo = simplify_exponent(expo)
        return dx**(expo + n) * symbolic_log(dx, hold=True)**k

    cm = get_coercion_model()
    Coeffs = cm.common_parent(dop.base_ring().base_ring(),
                              point.value.parent(),
                              *(sol.leftmost for sol in sols))
    res = [
        FormalSum([(c / ZZ(k).factorial(), log_monomial(sol.leftmost, n, k))
                   for n, vec in enumerate(sol.value)
                   for k, c in reversed(list(enumerate(vec)))],
                  FormalSums(Coeffs)) for sol in sols
    ]
    return res