Interface Magma<E>

All Superinterfaces:
Set<E>
All Known Subinterfaces:
AbelianGroup<E>, AbelianMonoid<E>, Algebra<E,F>, BanachAlgebra<E,F>, BanachSpace<E,S>, CStarAlgebra<E,F>, DivisionRing<E>, Field<E>, FiniteGroup<E>, GradedAlgebra<E,F>, Group<E>, HilbertSpace<E,S>, KleeneAlgebra<E>, LieAlgebra<E,S>, Loop<E>, Matrix<E>, Module<M,R>, Monoid<E>, NonAssociativeAlgebra<E,S>, OrderedGroup<E>, Quasigroup<E>, Ring<E>, SemiLattice<E>, Semiring<E>, Vector<E>, VectorSpace<V,F>
All Known Implementing Classes:
Boolean, BooleanAlgebra, Booleans, CliffordAlgebra, Complex, Complexes, CyclicGroup, DenseMatrix, DenseVector, DihedralGroup, DoubleField, FreeGroup, GenericMatrix, GenericVector, Integer, Integers, LieGroup, MatrixLieAlgebra, MMapMatrix, NativeRealBig, NativeRealDoubleMatrix, NativeRealDoubleVector, NativeRealFloatMatrix, Natural, Naturals, Octonion, Octonions, PolynomialRing, Quaternion, QuaternionGroup, Quaternions, Rational, Rationals, Real, RealBig, RealDouble, RealDoubleMatrix, RealDoubleVector, RealFloat, RealFloatVector, Reals, SIMDRealDoubleMatrix, SIMDRealFloatMatrix, SO3_1Group, SparseMatrix, SparseVector, SquareMatrices, SU2Group, SU3Group, SymmetricGroup, TiledMatrix, U1Group, Vector2D, Vector3D, Vector4D, VectorND, VectorSpace2D, VectorSpace3D

public interface Magma<E> extends Set<E>
A magma is a set equipped with a binary operation.

This is the simplest algebraic structure with an operation. The operation is not required to be associative, commutative, or have an identity element.

Mathematical Definition

A magma (S, ∗) consists of:

  • A set S
  • A binary operation ∗ : S × S → S
The only requirement is closure: for all a, b ∈ S, a ∗ b ∈ S.

Examples

  • (â„•, −) - Natural numbers with subtraction (not a semigroup, not associative)
  • (ℤ, ÷) - Integers with division (not closed, only a partial magma)
  • (ℝ, +) - Real numbers with addition (actually a group)

Hierarchy

Magma (closure)
↓
Semigroup (+ associativity)
↓
Monoid (+ identity)
↓
Group (+ inverse)

Usage

Since:
1.0
Author:
Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
  • Method Summary

    Modifier and Type
    Method
    Description
    default boolean
    Tests whether this magma's operation is associative.
    default boolean
    Tests whether this magma's operation is commutative.
    operate(E a, E b)
    Performs the binary operation on two elements.

    Methods inherited from interface Set

    contains, description, isEmpty
  • Method Details

    • operate

      E operate(E a, E b)
      Performs the binary operation on two elements.

      This is the fundamental operation of a magma. The result must be an element of this magma (closure property).

      Properties: None required (not necessarily associative or commutative)

      Parameters:
      a - the first operand
      b - the second operand
      Returns:
      the result of a ∗ b
      Throws:
      NullPointerException - if either operand is null
      IllegalArgumentException - if either operand is not in this magma
      See Also:
    • isAssociative

      default boolean isAssociative()
      Tests whether this magma's operation is associative.

      An operation ∗ is associative if for all a, b, c:
      (a ∗ b) ∗ c = a ∗ (b ∗ c)

      If this returns true, this magma is actually a

      invalid reference
      Semigroup
      .

      Returns:
      true if the operation is associative
      See Also:
      • invalid reference
        Semigroup
    • isCommutative

      default boolean isCommutative()
      Tests whether this magma's operation is commutative.

      An operation ∗ is commutative if for all a, b:
      a ∗ b = b ∗ a

      Returns:
      true if the operation is commutative