Class Reals

java.lang.Object
org.episteme.core.mathematics.sets.Reals
All Implemented Interfaces:
AbelianGroup<Real>, AbelianMonoid<Real>, Group<Real>, Magma<Real>, Monoid<Real>, Field<Real>, Ring<Real>, Semiring<Real>, InfiniteSet<Real>, Set<Real>

public final class Reals extends Object implements Field<Real>, InfiniteSet<Real>
The structure of real numbers (ℝ).

This class represents the structure of real numbers, not individual elements. It implements Field because ℝ forms a field under addition and multiplication.

Real numbers are an infinite, uncountable set.

Usage

Reals structure = Reals.getInstance();
Real pi = Real.of(3.14159);
Real two = Real.of(2.0);

// Use structure for operations
Real twoPi = structure.multiply(pi, two);
Real halfPi = structure.divide(pi, two);
Since:
1.0
Author:
Gemini AI (Google DeepMind)
See Also:
  • Field Details

    • INSTANCE

      public static final Reals INSTANCE
      Singleton instance
  • Method Details

    • getInstance

      public static Reals getInstance()
      Returns the singleton instance.
      Returns:
      the Reals structure
    • operate

      public Real operate(Real a, Real b)
      Description copied from interface: Magma
      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)

      Specified by:
      operate in interface Magma<Real>
      Parameters:
      a - the first operand
      b - the second operand
      Returns:
      the result of a ∗ b
      See Also:
    • add

      public Real add(Real a, Real b)
      Description copied from interface: AbelianMonoid
      Returns the sum of two elements (additive notation).

      Delegates to Magma.operate(Object, Object).

      Specified by:
      add in interface AbelianMonoid<Real>
      Parameters:
      a - the first addend
      b - the second addend
      Returns:
      a + b
    • characteristic

      public int characteristic()
      Description copied from interface: Field
      Returns the characteristic of this field.

      The characteristic is the smallest positive integer n such that:
      1 + 1 + ... + 1 (n times) = 0
      If no such n exists, the characteristic is 0.

      Examples:

      • char(ℚ) = char(ℝ) = char(â„‚) = 0
      • char(𝔽ₚ) = p (for prime p)

      Specified by:
      characteristic in interface Field<Real>
      Returns:
      the characteristic (0 for infinite fields, p for finite fields)
    • zero

      public Real zero()
      Description copied from interface: AbelianMonoid
      Returns the additive identity (zero element).

      Delegates to AbelianMonoid.identity().

      Specified by:
      zero in interface AbelianMonoid<Real>
      Returns:
      the zero element
    • negate

      public Real negate(Real element)
      Description copied from interface: AbelianGroup
      Returns the additive inverse (negation) of an element.

      Satisfies: a + (-a) = (-a) + a = 0

      Specified by:
      negate in interface AbelianGroup<Real>
      Parameters:
      element - the element to negate
      Returns:
      -element
      See Also:
    • multiply

      public Real multiply(Real a, Real b)
      Description copied from interface: Semiring
      Returns the product of two elements.

      Multiplication must be associative and distribute over addition.

      Specified by:
      multiply in interface Semiring<Real>
      Parameters:
      a - the first factor
      b - the second factor
      Returns:
      a × b
    • one

      public Real one()
      Description copied from interface: Semiring
      Returns the multiplicative identity (one element).

      Satisfies: 1 × a = a × 1 = a for all elements a.

      Specified by:
      one in interface Semiring<Real>
      Returns:
      the multiplicative identity
    • isMultiplicationCommutative

      public boolean isMultiplicationCommutative()
      Description copied from interface: Field
      Fields always have commutative multiplication.
      Specified by:
      isMultiplicationCommutative in interface Field<Real>
      Specified by:
      isMultiplicationCommutative in interface Semiring<Real>
      Returns:
      always true
    • inverse

      public Real inverse(Real element)
      Description copied from interface: Field
      Returns the multiplicative inverse of a non-zero element.

      For element a ≠ 0, returns a⁻¹ such that: a × a⁻¹ = a⁻¹ × a = 1

      Examples:

      • In ℚ: inverse(2/3) = 3/2
      • In ℝ: inverse(5.0) = 0.2
      • In â„‚: inverse(3+4i) = (3-4i)/25

      Specified by:
      inverse in interface Field<Real>
      Specified by:
      inverse in interface Group<Real>
      Parameters:
      element - the element to invert (must be non-zero)
      Returns:
      the multiplicative inverse
      See Also:
    • isCountable

      public boolean isCountable()
      Description copied from interface: InfiniteSet
      Returns true if this set is countable (i.e., its elements can be put in one-to-one correspondence with the natural numbers).

      Examples:

      • Countable: â„• (Natural numbers), ℤ (Integers), ℚ (Rational numbers)
      • Uncountable: ℝ (Real numbers), â„‚ (Complex numbers)

      Specified by:
      isCountable in interface InfiniteSet<Real>
      Returns:
      true if this set is countable
    • contains

      public boolean contains(Real element)
      Description copied from interface: Set
      Tests whether this set contains the specified element.

      This is the fundamental operation of a set - membership testing.

      Specified by:
      contains in interface Set<Real>
      Parameters:
      element - the element to test for membership
      Returns:
      true if this set contains the element, false otherwise
      See Also:
    • isEmpty

      public boolean isEmpty()
      Description copied from interface: Set
      Returns true if this set contains no elements.

      The empty set (∅) is a fundamental concept in set theory. It is the unique set containing no elements.

      Specified by:
      isEmpty in interface Set<Real>
      Returns:
      true if this set is empty
    • description

      public String description()
      Description copied from interface: Set
      Returns a human-readable description of this set.

      Examples:

      • "ℝ (Real Numbers)"
      • "ℤ/12ℤ (Integers modulo 12)"
      • "{1, 2, 3, 4, 5}"

      Specified by:
      description in interface Set<Real>
      Returns:
      a description of this set
    • toString

      public String toString()
      Overrides:
      toString in class Object