Examples of commutative additive monoids

sage.categories.examples.commutative_additive_monoids.Example
alias of FreeCommutativeAdditiveMonoid
class sage.categories.examples.commutative_additive_monoids.FreeCommutativeAdditiveMonoid(alphabet=('a', 'b', 'c', 'd'))

Bases: sage.categories.examples.commutative_additive_semigroups.FreeCommutativeAdditiveSemigroup

An example of a commutative additive monoid: the free commutative monoid

This class illustrates a minimal implementation of a commutative monoid.

EXAMPLES:

sage: S = CommutativeAdditiveMonoids().example(); S
An example of a commutative monoid: the free commutative monoid generated by ('a', 'b', 'c', 'd')

sage: S.category()
Category of commutative additive monoids

This is the free semigroup generated by:

sage: S.additive_semigroup_generators()
Family (a, b, c, d)

with product rule given by a \times b = a for all a, b:

sage: (a,b,c,d) = S.additive_semigroup_generators()

We conclude by running systematic tests on this commutative monoid:

sage: TestSuite(S).run(verbose = True)
running ._test_additive_associativity() . . . pass
running ._test_an_element() . . . pass
running ._test_category() . . . pass
running ._test_elements() . . . 
  Running the test suite of self.an_element()
  running ._test_category() . . . pass
  running ._test_eq() . . . pass
  running ._test_not_implemented_methods() . . . pass
  running ._test_pickling() . . . pass
  pass
running ._test_elements_eq() . . . pass
running ._test_eq() . . . pass
running ._test_not_implemented_methods() . . . pass
running ._test_pickling() . . . pass
running ._test_some_elements() . . . pass
running ._test_zero() . . . pass
zero(*args, **kwds)

Returns the zero of this additive monoid, as per CommutativeAdditiveMonoids.ParentMethods.zero().

EXAMPLES:

sage: M = CommutativeAdditiveMonoids().example(); M
An example of a commutative monoid: the free commutative monoid generated by ('a', 'b', 'c', 'd')
sage: M.zero()
0

Previous topic

Examples of algebras with basis

Next topic

Examples of commutative additive semigroups

This Page