Bases: sage.categories.category_singleton.Category_singleton
The category of abelian monoids semigroups with an additive identity element
EXAMPLES:
sage: CommutativeAdditiveMonoids()
Category of commutative additive monoids
sage: CommutativeAdditiveMonoids().super_categories()
[Category of commutative additive semigroups]
sage: CommutativeAdditiveMonoids().all_super_categories()
[Category of commutative additive monoids, Category of commutative additive semigroups, Category of additive magmas, Category of sets, Category of sets with partial maps, Category of objects]
TESTS:
sage: TestSuite(CommutativeAdditiveMonoids()).run()
n-ary sum
INPUT:
- args – a list (or iterable) of elements of self
Returns the sum of the elements in , as an element of
.
EXAMPLES:
sage: S = CommutativeAdditiveMonoids().example()
sage: (a,b,c,d) = S.additive_semigroup_generators()
sage: S.sum((a,b,a,c,a,b))
3*a + c + 2*b
sage: S.sum(())
0
sage: S.sum(()).parent() == S
True
Returns the zero of the abelian monoid, that is the unique neutral element for .
The default implementation is to coerce 0 into self.
It is recommended to override this method because the coercion from the integers:
- is not always meaningful (except for
),
- often uses self.zero() otherwise.
EXAMPLES:
sage: S = CommutativeAdditiveMonoids().example()
sage: S.zero()
0
Backward compatibility alias for self.zero()
TESTS:
sage: S = CommutativeAdditiveMonoids().example()
sage: S.zero_element()
0
Bases: sage.categories.with_realizations.WithRealizationsCategory
TESTS:
sage: from sage.categories.covariant_functorial_construction import CovariantConstructionCategory
sage: class FooBars(CovariantConstructionCategory):
... _functor_category = "FooBars"
sage: Category.FooBars = lambda self: FooBars.category_of(self)
sage: C = FooBars(ModulesWithBasis(ZZ))
sage: C
Category of foo bars of modules with basis over Integer Ring
sage: C.base_category()
Category of modules with basis over Integer Ring
sage: latex(C)
\mathbf{FooBars}(\mathbf{ModulesWithBasis}_{\Bold{Z}})
sage: import __main__; __main__.FooBars = FooBars # Fake FooBars being defined in a python module
sage: TestSuite(C).run()
alias of WithRealizations.ParentMethods
EXAMPLES:
sage: CommutativeAdditiveMonoids().super_categories()
[Category of commutative additive semigroups]