abelian group¶
Abelian Group¶
Abelian Group
Mathematically an Abelian Group is a Commutative Monoid G all of
whose elements have additive inverses.
Note
Addition is used for the group operation.
Important
Contract: AbelianGroup initializer parameters must have
add closed, associative and commutative on reps
zero additive identity on reps,
rep.add(zero) == rep == zero.add(rep)negate must me idempotent:
neg(neg(rep)) == rep
- class boring_math.abstract_algebra.algebras.abelian_group.AbelianGroup¶
Bases:
CommutativeMonoid,Generic- __init__(add: Callable[[H, H], H], zero: H, negate: Callable[[H], H], narrow: Callable[[H], H] | None = None)¶
init
- param add:
Closed, commutative and associative function on reps.
- param zero:
Representation for additive identity.
- param negate:
Function mapping element representation to the representation of corresponding negated element.
- param narrow:
Narrow the rep type, many-to-one function. Like choosing an element from a particular group coset.
- class boring_math.abstract_algebra.algebras.abelian_group.AbelianGroupElement¶
Bases:
CommutativeMonoidElement,Generic- __init__(rep: H, algebra: AbelianGroup[H]) None¶
init
- param rep:
Coset element to be narrowed.
- param algebra:
Abelian group to which element belongs.
- __str__() str¶
user string
Construct string ‘AbelianGroupElement<rep_str>’ where rep_str = str(rep).
- returns:
A string meaningful to an end user.
- __mul__(n: object) Self¶
mul
Repeatedly add an element to itself
n >= 0times.- param n:
Object, usually an
intor action.- returns:
If n: int then self, or its negative, added n times, else NotImplemented.
- raises ValueError:
When n <= 0.
- raises ValueError:
If self and other are same type but different concrete algebras.
- raises TypeError:
If an add method was not defined on the algebra.
- raises TypeError:
If algebra does not have an additive identity.
- raises TypeError:
Element multiplication attempted but algebra is not multiplicative.