group¶
Group¶
Group
Mathematically a Group is a Monoid G all of whose elements
have multiplicative inverses.
Caution
No assumptions are made whether or not the group is Abelian.
Important
Contract: Group initializer parameters must have
mult closed and associative on reps
one an identity on reps,
rep*one == rep == one*repinv must me idempotent:
inv(inv(rep)) == rep
- class boring_math.abstract_algebra.algebras.group.Group¶
Bases:
Monoid,Generic- Parameters:
mult – Associative function
H X H -> Hon representations.one – Representation for multiplicative identity.
invert – Function
H -> Hmapping element representation to the representation of corresponding inverse element.narrow – Narrow the rep type, many-to-one function. Like choosing an element from a coset of a group.
- __init__(mult: Callable[[H, H], H], one: H, invert: Callable[[H], H], narrow: Callable[[H], H] | None = None)¶
- Parameters:
mult – Associative function
H X H -> Hon representations.one – Representation for multiplicative identity.
invert – Function
H -> Hmapping element representation to the representation of corresponding inverse element.narrow – Narrow the rep type, many-to-one function. Like choosing an element from a coset of a group.
- class boring_math.abstract_algebra.algebras.group.GroupElement¶
Bases:
MonoidElement,Generic- __str__() str¶
- Returns:
str(self) = GroupElement<rep>
- __pow__(n: int) Self¶
Raise the element to the power of
n.- Parameters:
n – The
intpower to raise the element to.- Returns:
The element (or its inverse) raised to the integer``n`` power.
- Raises:
ValueError – If element’s algebra
ValueError – If
selfandotherare same type but different concrete groups.ValueError – If algebra fails to have an identity or elements not invertible.
- __mul__(right: object) Self¶
Multiply two elements of the same concrete algebra together.
- Parameters:
right – An element within the same concrete algebra or a right action.
- Returns:
The product
self * rightotherwiseNotImplemented.- Raises:
ValueError – If
selfandrightare same type but different concrete algebras.
- __rmul__(left: object) Self¶
When left side of multiplication does not know how to multiply right side.
- Parameters:
left – Left side of the multiplication.
- Returns:
Never returns, otherwise
left.__mul__(right)would have worked.- Raises:
TypeError – When multiplying on left by an int.