def steenrod_algebra_basis(n, basis='milnor', p=2, **kwds):
    r"""
    Basis for the Steenrod algebra in degree `n`.

    INPUT:

    - ``n`` - non-negative integer
    - ``basis`` - string, which basis to use (optional, default = 'milnor')
    - ``p`` - positive prime number (optional, default = 2)
    - ``profile`` - profile function (optional, default None).  This
      is just passed on to the functions :func:`milnor_basis` and
      :func:`pst_basis`.
    - ``truncation_type`` - truncation type, either 0 or Infinity
      (optional, default Infinity if no profile function is specified,
      0 otherwise).  This is just passed on to the function
      :func:`milnor_basis`.

    OUTPUT:
        
    Tuple of objects representing basis elements for the Steenrod algebra
    in dimension n.

    .. note::
    
        Users should use :func:`steenrod_algebra_basis` instead of
        this function (which has a trailing underscore in its name):
        :func:`steenrod_algebra_basis` is the cached version of this
        one, and so will be faster.

    The choices for the string ``basis`` are as follows; see the
    documentation for :mod:`sage.algebras.steenrod.steenrod_algebra`
    for details on each basis:

    - 'milnor': Milnor basis.
    - 'serre-cartan' or 'adem' or 'admissible': Serre-Cartan basis.
    - 'pst', 'pst_rlex', 'pst_llex', 'pst_deg', 'pst_revz':
      various `P^s_t`-bases.
    - 'comm', 'comm_rlex', 'comm_llex', 'comm_deg', 'comm_revz', or
      any of these with '_long' appended: various commutator bases.

    The rest of these bases are only defined when `p=2`.
    
    - 'wood_y': Wood's Y basis.
    - 'wood_z': Wood's Z basis. 
    - 'wall' or 'wall_long': Wall's basis.
    -  'arnon_a' or 'arnon_a_long': Arnon's A basis.
    -  'arnon_c': Arnon's C basis.

    EXAMPLES::

        sage: from sage.algebras.steenrod.steenrod_algebra_bases import steenrod_algebra_basis
        sage: steenrod_algebra_basis(7,'milnor') # indirect doctest
        ((0, 0, 1), (1, 2), (4, 1), (7,))
        sage: steenrod_algebra_basis(5)   # milnor basis is the default
        ((2, 1), (5,))

    Bases in negative dimensions are empty::

        sage: steenrod_algebra_basis(-2, 'wall')
        ()
    
    The third (optional) argument to 'steenrod_algebra_basis' is the
    prime p::
    
        sage: steenrod_algebra_basis(9, 'milnor', p=3)
        (((1,), (1,)), ((0,), (2,)))
        sage: steenrod_algebra_basis(9, 'milnor', 3)
        (((1,), (1,)), ((0,), (2,)))
        sage: steenrod_algebra_basis(17, 'milnor', 3)
        (((2,), ()), ((1,), (3,)), ((0,), (0, 1)), ((0,), (4,)))
    
    Other bases::
    
        sage: steenrod_algebra_basis(7,'admissible')
        ((7,), (6, 1), (4, 2, 1), (5, 2))
        sage: steenrod_algebra_basis(13,'admissible',p=3)
        ((1, 3, 0), (0, 3, 1))
        sage: steenrod_algebra_basis(5,'wall')
        (((2, 2), (0, 0)), ((1, 1), (1, 0)))
        sage: steenrod_algebra_basis(5,'wall_long')
        (((2, 2), (0, 0)), ((1, 1), (1, 0)))
        sage: steenrod_algebra_basis(5,'pst-rlex')
        (((0, 1), (2, 1)), ((1, 1), (0, 2)))
    """
    from steenrod_algebra_misc import get_basis_name
    try:
        if n < 0 or int(n) != n:
            return ()
    except TypeError:
        return ()

    basis_name = get_basis_name(basis, p)
    if basis_name.find('long') >= 0:
        long = True
        basis_name = basis_name.rsplit('_', 1)[0]
    else:
        long = False

    profile = kwds.get("profile", None)
    if (profile is not None and profile != () and profile != ((), ())
            and basis != 'milnor' and basis.find('pst') == -1):
        raise ValueError, "Profile functions may only be used with the Milnor or pst bases"

    ## Milnor basis
    if basis_name == 'milnor':
        return milnor_basis(n, p, **kwds)
    ## Serre-Cartan basis
    elif basis_name == 'serre-cartan':
        return serre_cartan_basis(n, p)
    ## Atomic bases, p odd:
    elif p > 2 and (basis_name.find('pst') >= 0
                    or basis_name.find('comm') >= 0):
        return atomic_basis_odd(n, basis_name, p, **kwds)
    ## Atomic bases, p=2
    elif p == 2 and (basis_name == 'woody' or basis_name == 'woodz'
                     or basis_name == 'wall' or basis_name == 'arnona'
                     or basis_name.find('pst') >= 0
                     or basis_name.find('comm') >= 0):
        return atomic_basis(n, basis_name, **kwds)
    ## Arnon 'C' basis
    elif p == 2 and basis == 'arnonc':
        return arnonC_basis(n)
    else:
        raise ValueError, "Unknown basis: %s at the prime %s" % (basis, p)
示例#2
0
def steenrod_algebra_basis(n, basis='milnor', p=2, **kwds):
    r"""
    Basis for the Steenrod algebra in degree `n`.

    INPUT:

    - ``n`` - non-negative integer
    - ``basis`` - string, which basis to use (optional, default = 'milnor')
    - ``p`` - positive prime number (optional, default = 2)
    - ``profile`` - profile function (optional, default None).  This
      is just passed on to the functions :func:`milnor_basis` and
      :func:`pst_basis`.
    - ``truncation_type`` - truncation type, either 0 or Infinity
      (optional, default Infinity if no profile function is specified,
      0 otherwise).  This is just passed on to the function
      :func:`milnor_basis`.

    OUTPUT:

    Tuple of objects representing basis elements for the Steenrod algebra
    in dimension n.

    .. note::

        Users should use :func:`steenrod_algebra_basis` instead of
        this function (which has a trailing underscore in its name):
        :func:`steenrod_algebra_basis` is the cached version of this
        one, and so will be faster.

    The choices for the string ``basis`` are as follows; see the
    documentation for :mod:`sage.algebras.steenrod.steenrod_algebra`
    for details on each basis:

    - 'milnor': Milnor basis.
    - 'serre-cartan' or 'adem' or 'admissible': Serre-Cartan basis.
    - 'pst', 'pst_rlex', 'pst_llex', 'pst_deg', 'pst_revz':
      various `P^s_t`-bases.
    - 'comm', 'comm_rlex', 'comm_llex', 'comm_deg', 'comm_revz', or
      any of these with '_long' appended: various commutator bases.

    The rest of these bases are only defined when `p=2`.

    - 'wood_y': Wood's Y basis.
    - 'wood_z': Wood's Z basis.
    - 'wall' or 'wall_long': Wall's basis.
    -  'arnon_a' or 'arnon_a_long': Arnon's A basis.
    -  'arnon_c': Arnon's C basis.

    EXAMPLES::

        sage: from sage.algebras.steenrod.steenrod_algebra_bases import steenrod_algebra_basis
        sage: steenrod_algebra_basis(7,'milnor') # indirect doctest
        ((0, 0, 1), (1, 2), (4, 1), (7,))
        sage: steenrod_algebra_basis(5)   # milnor basis is the default
        ((2, 1), (5,))

    Bases in negative dimensions are empty::

        sage: steenrod_algebra_basis(-2, 'wall')
        ()

    The third (optional) argument to 'steenrod_algebra_basis' is the
    prime p::

        sage: steenrod_algebra_basis(9, 'milnor', p=3)
        (((1,), (1,)), ((0,), (2,)))
        sage: steenrod_algebra_basis(9, 'milnor', 3)
        (((1,), (1,)), ((0,), (2,)))
        sage: steenrod_algebra_basis(17, 'milnor', 3)
        (((2,), ()), ((1,), (3,)), ((0,), (0, 1)), ((0,), (4,)))

    Other bases::

        sage: steenrod_algebra_basis(7,'admissible')
        ((7,), (6, 1), (4, 2, 1), (5, 2))
        sage: steenrod_algebra_basis(13,'admissible',p=3)
        ((1, 3, 0), (0, 3, 1))
        sage: steenrod_algebra_basis(5,'wall')
        (((2, 2), (0, 0)), ((1, 1), (1, 0)))
        sage: steenrod_algebra_basis(5,'wall_long')
        (((2, 2), (0, 0)), ((1, 1), (1, 0)))
        sage: steenrod_algebra_basis(5,'pst-rlex')
        (((0, 1), (2, 1)), ((1, 1), (0, 2)))
    """
    from steenrod_algebra_misc import get_basis_name
    try:
        if n < 0 or int(n) != n:
            return ()
    except TypeError:
        return ()

    basis_name = get_basis_name(basis, p)
    if basis_name.find('long') >= 0:
        long = True
        basis_name = basis_name.rsplit('_', 1)[0]
    else:
        long = False

    profile = kwds.get("profile", None)
    if (profile is not None and profile != () and profile != ((), ())
        and basis != 'milnor' and basis.find('pst') == -1):
        raise ValueError("Profile functions may only be used with the Milnor or pst bases")

    ## Milnor basis
    if basis_name == 'milnor':
        return milnor_basis(n,p, **kwds)
    ## Serre-Cartan basis
    elif basis_name == 'serre-cartan':
        return serre_cartan_basis(n,p)
    ## Atomic bases, p odd:
    elif p > 2 and (basis_name.find('pst') >= 0
                    or basis_name.find('comm') >= 0):
        return atomic_basis_odd(n, basis_name, p, **kwds)
    ## Atomic bases, p=2
    elif p == 2 and (basis_name == 'woody' or basis_name == 'woodz'
                     or basis_name == 'wall' or basis_name == 'arnona'
                     or basis_name.find('pst') >= 0
                     or basis_name.find('comm') >= 0):
        return atomic_basis(n, basis_name, **kwds)
    ## Arnon 'C' basis
    elif p == 2 and basis == 'arnonc':
        return arnonC_basis(n)
    else:
        raise ValueError("Unknown basis: %s at the prime %s" % (basis, p))