Additive Magmas

class sage.categories.additive_magmas.AdditiveMagmas(s=None)

Bases: sage.categories.category.Category

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

EXAMPLES:

sage: AdditiveMagmas()
Category of additive magmas
sage: AdditiveMagmas().super_categories()
[Category of sets]
sage: AdditiveMagmas().all_super_categories()
[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
class AdditiveMagmas.ParentMethods
addition_table(names='letters', elements=None)

Returns the addition table for this set.

Warning

There is a shortage of finite additive structures available within the categories framework so this method is not very useful right now. So there is only the bare minimum of documentation here.

See the multiplication_table() documentation, it is entirely analogous. Also, the returned object is an OperationTable and there is extensive documentation there.

TESTS:

A finite, closed subset of an algebraic structure with an additive operation.

sage: F=CommutativeAdditiveMonoids().example(('a','b'))
sage: F
An example of a commutative monoid: the free commutative monoid generated by ('a', 'b')
sage: z=F.zero()
sage: T=F.addition_table(names=['z'], elements=[z])
sage: T
+  z
 +--
z| z
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: (a,b,c,d) = S.additive_semigroup_generators()
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.

Todo: add an example.

summation_from_element_class_add(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: (a,b,c,d) = S.additive_semigroup_generators()
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.

Todo: add an example.

AdditiveMagmas.super_categories(*args, **kwds)

EXAMPLES:

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

Previous topic

Isomorphic Objects Functorial Construction

Next topic

AlgebraIdeals

This Page