field¶
Field¶
Field
Mathematically a Field is a Commutative Ring all whose non-zero elements have multiplicative inverses.
By convention one != zero, otherwise the algebra consists
of just one unique element.
Important
Contract: Field initializer parameters must have
add closed, commutative and associative on reps
mult closed, commutative and associative on reps
one an identity on reps,
rep*one == rep == one*repzero an identity on reps,
rep+zero == rep == zero+repinv is the mult inverse function on all non-zero reps
negate function to negate all proper rep values
invert function to invert all proper rep values
zero
!=one (by convention)
- class boring_math.abstract_algebra.algebras.field.Field¶
Bases:
CommutativeRing,Generic- __init__(mult: Callable[[H, H], H], add: Callable[[H, H], H], one: H, zero: H, negate: Callable[[H], H], invert: Callable[[H], H], narrow: Callable[[H], H] | None = None)¶
- Parameters:
mult – Closed associative function reps.
add – Closed commutative and associative function reps.
one – Representation for multiplicative identity.
zero – Representation for additive identity.
negate – Function mapping element representation to the representation of corresponding negated element.
invert – Function mapping non-zero element representations to their multiplicative inverses.
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.field.FieldElement¶
Bases:
CommutativeRingElement,Generic- __pow__(n: int) Self¶
Raise the element to the
intpower ofn.- Parameters:
n – The
intpower to raise the element to.- Returns:
The element (or its inverse) raised to an
intpower.- Raises:
ValueError – If algebra is not multiplicative.
ValueError – If algebra does not have a multiplicative identity element.
ValueError – If algebra does not have multiplicative inverses.