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¶
-
- __init__(mult: Callable[[H, H], H], one: H, invert: Callable[[H], H], narrow: Callable[[H], H] | None = None)¶
init
- param mult:
Associative function
H X H -> Hon representations.- param one:
Representation for multiplicative identity.
- param invert:
Function
H -> Hmapping element representation to the representation of corresponding inverse element.- param 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- __init__(rep: H, algebra: Group[H]) None¶
init
- param rep:
Representative to to narrow when adding element.
- param algebra:
Monoid to add element to.
- __str__() str¶
user string
Construct the string ‘GroupElement<rep_str>’ where rep_str = str(rep).
- returns:
A string meaningful to an end user.
- __pow__(n: int) Self¶
pow
Raise the element to the integer power of n.
- param n:
The int power to raise the element to.
- returns:
The element (or its inverse) raised to the integer n power.
- raises ValueError:
If element’s algebra
- raises ValueError:
If
selfandotherare same type but different concrete groups.- raises ValueError:
If algebra fails to have an identity or elements not invertible.