Bases: sage.categories.category_singleton.Category_singleton

The category of additive magmas, i.e. sets with an binary operation +.

EXAMPLES:

sage: AdditiveMagmas()
[Category of sets]
[Category of additive magmas, Category of sets, Category of sets with partial maps, Category of objects]


TESTS:

sage: C = AdditiveMagmas()
sage: TestSuite(C).run()

class ElementMethods

Returns a table describing the addition operation.

Note

The order of the elements in the row and column headings is equal to the order given by the table’s list() method. The association can also be retrieved with the dict() method.

INPUTS:

• names - the type of names used
• 'letters' - lowercase ASCII letters are used for a base 26 representation of the elements’ positions in the list given by column_keys(), padded to a common width with leading ‘a’s.
• 'digits' - base 10 representation of the elements’ positions in the list given by column_keys(), padded to a common width with leading zeros.
• 'elements' - the string representations of the elements themselves.
• a list - a list of strings, where the length of the list equals the number of elements.
• elements - default = None. A list of elements of the additive magma, in forms that can be coerced into the structure, eg. their string representations. This may be used to impose an alternate ordering on the elements, perhaps when this is used in the context of a particular structure. The default is to use whatever ordering the S.list method returns. Or the elements can be a subset which is closed under the operation. In particular, this can be used when the base set is infinite.

OUTPUT: The addition table as an object of the class OperationTable which defines several methods for manipulating and displaying the table. See the documentation there for full details to supplement the documentation here.

EXAMPLES:

All that is required is that an algebraic structure has an addition defined.The default is to represent elements as lowercase ASCII letters.

sage: R=IntegerModRing(5)
+  a b c d e
+----------
a| a b c d e
b| b c d e a
c| c d e a b
d| d e a b c
e| e a b c d


The names argument allows displaying the elements in different ways. Requesting elements will use the representation of the elements of the set. Requesting digits will include leading zeros as padding.

sage: R=IntegerModRing(11)
sage: P
+   0  1  2  3  4  5  6  7  8  9 10
+---------------------------------
0|  0  1  2  3  4  5  6  7  8  9 10
1|  1  2  3  4  5  6  7  8  9 10  0
2|  2  3  4  5  6  7  8  9 10  0  1
3|  3  4  5  6  7  8  9 10  0  1  2
4|  4  5  6  7  8  9 10  0  1  2  3
5|  5  6  7  8  9 10  0  1  2  3  4
6|  6  7  8  9 10  0  1  2  3  4  5
7|  7  8  9 10  0  1  2  3  4  5  6
8|  8  9 10  0  1  2  3  4  5  6  7
9|  9 10  0  1  2  3  4  5  6  7  8
10| 10  0  1  2  3  4  5  6  7  8  9

sage: T
+  00 01 02 03 04 05 06 07 08 09 10
+---------------------------------
00| 00 01 02 03 04 05 06 07 08 09 10
01| 01 02 03 04 05 06 07 08 09 10 00
02| 02 03 04 05 06 07 08 09 10 00 01
03| 03 04 05 06 07 08 09 10 00 01 02
04| 04 05 06 07 08 09 10 00 01 02 03
05| 05 06 07 08 09 10 00 01 02 03 04
06| 06 07 08 09 10 00 01 02 03 04 05
07| 07 08 09 10 00 01 02 03 04 05 06
08| 08 09 10 00 01 02 03 04 05 06 07
09| 09 10 00 01 02 03 04 05 06 07 08
10| 10 00 01 02 03 04 05 06 07 08 09


Specifying the elements in an alternative order can provide more insight into how the operation behaves.

sage: S=IntegerModRing(7)
sage: elts = [0, 3, 6, 2, 5, 1, 4]
+  a b c d e f g
+--------------
a| a b c d e f g
b| b c d e f g a
c| c d e f g a b
d| d e f g a b c
e| e f g a b c d
f| f g a b c d e
g| g a b c d e f


The elements argument can be used to provide a subset of the elements of the structure. The subset must be closed under the operation. Elements need only be in a form that can be coerced into the set. The names argument can also be used to request that the elements be represented with their usual string representation.

sage: T=IntegerModRing(12)
sage: elts=[0, 3, 6, 9]
+  0 3 6 9
+--------
0| 0 3 6 9
3| 3 6 9 0
6| 6 9 0 3
9| 9 0 3 6


The table returned can be manipulated in various ways. See the documentation for OperationTable for more comprehensive documentation.

sage: R=IntegerModRing(3)
sage: T.column_keys()
(0, 1, 2)
sage: sorted(T.translation().items())
[('a', 0), ('b', 1), ('c', 2)]
sage: T.change_names(['x', 'y', 'z'])
sage: sorted(T.translation().items())
[('x', 0), ('y', 1), ('z', 2)]
sage: T
+  x y z
+------
x| x y z
y| y z x
z| z x y

summation(x, y)

The binary addition operator of the semigroup

INPUT:

• x, y – elements of this additive semigroup

Returns the sum of x and y

EXAMPLES:

sage: S = CommutativeAdditiveSemigroups().example()
sage: S.summation(a, b)
a + b


A parent in AdditiveMagmas() must either implement summation() in the parent class or _add_ in the element class. By default, the addition method on elements x._add_(y) calls S.summation(x,y), and reciprocally.

As a bonus effect, S.summation by itself models the binary function from S to S:

sage: bin = S.summation
sage: bin(a,b)
a + b


Here, S.summation is just a bound method. Whenever possible, it is recommended to enrich S.summation with extra mathematical structure. Lazy attributes can come handy for this.

The binary addition operator of the semigroup

INPUT:

• x, y – elements of this additive semigroup

Returns the sum of x and y

EXAMPLES:

sage: S = CommutativeAdditiveSemigroups().example()
sage: S.summation(a, b)
a + b


A parent in AdditiveMagmas() must either implement summation() in the parent class or _add_ in the element class. By default, the addition method on elements x._add_(y) calls S.summation(x,y), and reciprocally.

As a bonus effect, S.summation by itself models the binary function from S to S:

sage: bin = S.summation
sage: bin(a,b)
a + b


Here, S.summation is just a bound method. Whenever possible, it is recommended to enrich S.summation with extra mathematical structure. Lazy attributes can come handy for this.

EXAMPLES:

sage: AdditiveMagmas().super_categories()
[Category of sets]


#### Previous topic

With Realizations Covariant Functorial Construction

AlgebraIdeals