Ticket #13209: 17436.patch

File 17436.patch, 12.1 KB (added by knsam, 10 years ago)

All Work relevant to this ticket has been carried out in this patch. No need to apply the previous patches... just this one will suffice.

  • sage/categories/additive_magmas.py

    # HG changeset patch
    # User Kannappan Sampath <kntrichy@gmail.com>
    # Date 1354192179 -19800
    # Node ID 672c9c28a28e24d2da44ba4dd27f7baf1960cd22
    # Parent  33242a07d2ab0920994f3125881c78458b96181b
    trac #13209 All docstrings fixed. Test (hence can also serve as an example)  added to show that elements can be passed as such or as strings, which are then coerced.
    
    diff --git a/sage/categories/additive_magmas.py b/sage/categories/additive_magmas.py
    a b  
    120120
    121121            - ``names`` - the type of names used
    122122
    123               * ``letters`` - lowercase ASCII letters are used
     123              * ``'letters'`` - lowercase ASCII letters are used
    124124                for a base 26 representation of the elements'
    125125                positions in the list given by
    126126                :meth:`~sage.matrix.operation_table.OperationTable.column_keys`,
    127127                padded to a common width with leading 'a's.
    128               * ``digits`` - base 10 representation of the
     128              * ``'digits'`` - base 10 representation of the
    129129                elements' positions in the list given by
    130130                :meth:`~sage.matrix.operation_table.OperationTable.column_keys`,
    131131                padded to a common width with leading zeros.
    132               * ``elements`` - the string representations
     132              * ``'elements'`` - the string representations
    133133                of the elements themselves.
    134134              * a list - a list of strings, where the length
    135135                of the list equals the number of elements.
    136136            - ``elements`` - default = ``None``.  A list of
    137               elements of the set.  This may be used to impose an
    138               alternate ordering on the elements, perhaps
     137              elements of the additive magma, in forms that can be coerced into the structure.
     138              This may be used to impose an alternate ordering on the elements, perhaps
    139139              when this is used in the context of a particular structure.
    140               The default is to use whatever ordering the
    141               ``S.list``
    142               method returns.  Or the ``elements`` can be a subset
    143               which is closed under the operation. In particular,
    144               this can be used when the base set is infinite.
     140              The default is to use whatever ordering the ``S.list`` method returns.
     141              Or the ``elements`` can be a subset which is closed under the operation. In
     142              particular, this can be used when the base set is infinite.
    145143
    146144            OUTPUT:
    147145            The addition table as an object of the class
  • sage/categories/groups.py

    diff --git a/sage/categories/groups.py b/sage/categories/groups.py
    a b  
    110110
    111111            - ``names`` - the type of names used, values are:
    112112
    113               * ``letters`` - lowercase ASCII letters are used
     113              * ``'letters'`` - lowercase ASCII letters are used
    114114                for a base 26 representation of the elements'
    115115                positions in the list given by :meth:`list`,
    116116                padded to a common width with leading 'a's.
    117               * ``digits`` - base 10 representation of the
     117              * ``'digits'`` - base 10 representation of the
    118118                elements' positions in the list given by
    119119                :meth:`~sage.matrix.operation_table.OperationTable.column_keys`,
    120120                padded to a common width with leading zeros.
    121               * ``elements`` - the string representations
     121              * ``'elements'`` - the string representations
    122122                of the elements themselves.
    123123              * a list - a list of strings, where the length
    124124                of the list equals the number of elements.
    125125
    126126            - ``elements`` - default = ``None``.  A list of
    127               elements of the set.  This may be used to impose an
    128               alternate ordering on the elements, perhaps
     127              elements of the group, in forms that can be coerced into the structure.
     128              This may be used to impose an alternate ordering on the elements, perhaps
    129129              when this is used in the context of a particular structure.
    130130              The default is to use whatever ordering is provided by the
    131131              the group, which is reported by the
     
    151151                ((), (5,6,7), (5,7,6)...(1,4,2,3)(5,7))
    152152                sage: T
    153153                *  a b c d e f g h i j k l
    154                 +------------------------
     154                 +------------------------
    155155                a| a b c d e f g h i j k l
    156156                b| b c a e f d i g h l j k
    157157                c| c a b f d e h i g k l j
     
    183183                sage: A=AbelianGroup([2,3])
    184184                sage: A.cayley_table()
    185185                *  a b c d e f
    186                 +------------
     186                 +------------
    187187                a| a b c d e f
    188188                b| b c a e f d
    189189                c| c a b f d e
  • sage/categories/magmas.py

    diff --git a/sage/categories/magmas.py b/sage/categories/magmas.py
    a b  
    148148
    149149            - ``names`` - the type of names used
    150150
    151               * ``letters`` - lowercase ASCII letters are used
     151              * ``'letters'`` - lowercase ASCII letters are used
    152152                for a base 26 representation of the elements'
    153153                positions in the list given by
    154154                :meth:`~sage.matrix.operation_table.OperationTable.column_keys`,
    155155                padded to a common width with leading 'a's.
    156               * ``digits`` - base 10 representation of the
     156              * ``'digits'`` - base 10 representation of the
    157157                elements' positions in the list given by
    158158                :meth:`~sage.matrix.operation_table.OperationTable.column_keys`,
    159159                padded to a common width with leading zeros.
    160               * ``elements`` - the string representations
     160              * ``'elements'`` - the string representations
    161161                of the elements themselves.
    162162              * a list - a list of strings, where the length
    163163                of the list equals the number of elements.
    164164            - ``elements`` - default = ``None``.  A list of
    165               elements of the set.  This may be used to impose an
    166               alternate ordering on the elements, perhaps
     165              elements of the magma, in forms that can be coerced into the structure.
     166              This may be used to impose an alternate ordering on the elements, perhaps
    167167              when this is used in the context of a particular structure.
    168               The default is to use whatever ordering the
    169               ``S.list``
    170               method returns.  Or the ``elements`` can be a subset
    171               which is closed under the operation. In particular,
    172               this can be used when the base set is infinite.
     168              The default is to use whatever ordering the ``S.list`` method returns.
     169              Or the ``elements`` can be a subset which is closed under the operation. In
     170              particular, this can be used when the base set is infinite.
    173171
    174172            OUTPUT:
    175173            The multiplication table as an object of the class
  • sage/matrix/operation_table.py

    diff --git a/sage/matrix/operation_table.py b/sage/matrix/operation_table.py
    a b  
    3333        :func:`operator.add` and :func:`operator.mul`. This may also
    3434        be a function defined with ``lambda`` or ``def.``
    3535
    36     - ``names`` - (default: ``letters``)  The type of names
     36    - ``names`` - (default: ``'letters'``)  The type of names
    3737      used, values are:
    3838
    39       * ``letters`` - lowercase ASCII letters are used
     39      * ``'letters'`` - lowercase ASCII letters are used
    4040        for a base 26 representation of the elements'
    4141        positions in the list given by
    4242        :meth:`~sage.matrix.operation_table.OperationTable.column_keys`,
    4343        padded to a common width with leading 'a's.
    44       * ``digits`` - base 10 representation of the
     44      * ``'digits'`` - base 10 representation of the
    4545        elements' positions in the list given by
    4646        :meth:`~sage.matrix.operation_table.OperationTable.column_keys`,
    4747        padded to a common width with leading zeros.
    48       * ``elements`` - the string representations
     48      * ``'elements'`` - the string representations
    4949        of the elements themselves.
    5050      * a list - a list of strings, where the length
    5151        of the list equals the number of elements.
    5252
    5353    - ``elements`` - (default: ``None``)  A list of
    54       elements of ``S``.  This may be used to impose an
    55       alternate ordering on the elements of ``S``, perhaps
     54      elements of ``S``, in forms that can be coerced into the structure.
     55      This may be used to impose an alternate ordering on the elements of ``S``, perhaps
    5656      when this is used in the context of a particular structure.
    57       The default is to use whatever ordering the
    58       ``S.list()`` method returns.
     57      The default is to use whatever ordering the ``S.list()`` method returns.
    5958      ``elements`` can also be a subset which is closed under
    6059      the operation, useful perhaps when the set is infinite.
    6160
     
    291290
    292291    The value of ``elements`` must be a subset of the algebraic
    293292    structure, in forms that can be coerced into the structure.
    294     Here we demonstrate the proper use first, followed by
    295     several improper uses::
     293    Here we demonstrate the proper use first::
    296294
    297295        sage: from sage.matrix.operation_table import OperationTable
    298296        sage: H=CyclicPermutationGroup(4)
     
    301299        sage: elts = ['()', '(1,3)(2,4)']
    302300        sage: OperationTable(H, operator.mul, elements=elts)
    303301        *  a b
    304         +----
     302         +----
    305303        a| a b
    306304        b| b a
     305
     306    This can be rewritten so as to pass the actual elements of the group ``H``,
     307    using a simple ``for`` loop::
     308
     309        sage: L = H.list()    #list of elements of the group H
     310        sage: elts = [L[i] for i in {0, 2}]
     311        sage: elts
     312        [(), (1,3)(2,4)]
     313        sage: OperationTable(H, operator.mul, elements=elts)
     314        *  a b
     315         +----
     316        a| a b
     317        b| b a
     318
     319    Here are a couple of improper uses ::
     320       
    307321        sage: elts.append(5)
    308322        sage: OperationTable(H, operator.mul, elements=elts)
    309323        Traceback (most recent call last):
     
    626640            sage: T=OperationTable(R, operation=operator.add)
    627641            sage: print(T._repr_())
    628642            +  a b c d e
    629             +----------
     643             +----------
    630644            a| a b c d e
    631645            b| b c d e a
    632646            c| c d e a b
     
    765779
    766780        - ``names`` - the type of names used, values are:
    767781
    768           * ``letters`` - lowercase ASCII letters are used
     782          * ``'letters'`` - lowercase ASCII letters are used
    769783            for a base 26 representation of the elements'
    770784            positions in the list given by :meth:`list`,
    771785            padded to a common width with leading 'a's.
    772           * ``digits`` - base 10 representation of the
     786          * ``'digits'`` - base 10 representation of the
    773787            elements' positions in the list given by
    774788            :meth:`list`, padded to a common width
    775789            with leading zeros.
    776           * ``elements`` - the string representations
     790          * ``'elements'`` - the string representations
    777791            of the elements themselves.
    778792          * a list - a list of strings, where the length
    779793            of the list equals the number of elements.
     
    796810            sage: T=OperationTable(D, operator.mul)
    797811            sage: T
    798812            *  a b c d
    799             +--------
     813             +--------
    800814            a| a b c d
    801815            b| b a d c
    802816            c| c d a b
     
    806820            sage: T.change_names('digits')
    807821            sage: T
    808822            *  0 1 2 3
    809             +--------
     823             +--------
    810824            0| 0 1 2 3
    811825            1| 1 0 3 2
    812826            2| 2 3 0 1
     
    826840            sage: T.change_names(['w', 'x', 'y', 'z'])
    827841            sage: T
    828842            *  w x y z
    829             +--------
     843             +--------
    830844            w| w x y z
    831845            x| x w z y
    832846            y| y z w x