commutative monoid¶
Commutative Monoid¶
Commutative Monoid
Mathematically a commutative Monoid is a Semigroup M along with
an identity element u, such that
(∃u ∈ M) => (∀m ∈ M)(u+m = m+u = m)
When such an identity element u exists, it is necessarily unique.
Important
Contract: Commutative Monoid initializer parameters must have
add closed commutative and associative on reps
zero an identity on reps,
rep+zero == rep == zero+rep
- class boring_math.abstract_algebra.algebras.commutative_monoid.CommutativeMonoid¶
Bases:
CommutativeSemigroup,Generic
- class boring_math.abstract_algebra.algebras.commutative_monoid.CommutativeMonoidElement¶
Bases:
CommutativeSemigroupElement,Generic- __init__(rep: H, algebra: CommutativeMonoid[H]) None¶
- __mul__(n: object) Self¶
Repeatedly add an element to itself
n >= 0times.- Parameters:
n – Object, usually a non-negative
intor action.- Returns:
If
n: intthen self added to itself n times else NotImplemented.- Raises:
ValueError – When
n < 0.ValueError – If
selfandotherare same type but different concrete algebras.TypeError – If algebra fails to have an additive identity element or an addition method.