Class Octonion

java.lang.Object
org.episteme.core.mathematics.numbers.complex.Octonion
All Implemented Interfaces:
AbelianGroup<Octonion>, AbelianMonoid<Octonion>, Group<Octonion>, Magma<Octonion>, Monoid<Octonion>, Field<Octonion>, Ring<Octonion>, Semiring<Octonion>, Set<Octonion>

public class Octonion extends Object implements Field<Octonion>
Represents an octonion number (8-dimensional hypercomplex number).

Octonions extend quaternions but are non-associative. They form the largest normed division algebra over the real numbers.

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

    • ZERO

      public static final Octonion ZERO
      The zero octonion.
    • ONE

      public static final Octonion ONE
      The unit (1,0,0,0,0,0,0,0).
  • Constructor Details

    • Octonion

      public Octonion(Real e0, Real e1, Real e2, Real e3, Real e4, Real e5, Real e6, Real e7)
      Creates an octonion from 8 real components. o = e0 + e1*i + e2*j + e3*k + e4*l + e5*il + e6*jl + e7*kl
    • Octonion

      public Octonion(double e0, double e1, double e2, double e3, double e4, double e5, double e6, double e7)
  • Method Details

    • fromQuaternion

      public static Octonion fromQuaternion(Quaternion q)
      Creates an octonion from a quaternion (last 4 components = 0).
    • fromComplex

      public static Octonion fromComplex(Complex c)
      Creates an octonion from a complex number (last 6 components = 0).
    • getE0

      public Real getE0()
    • getE1

      public Real getE1()
    • getE2

      public Real getE2()
    • getE3

      public Real getE3()
    • getE4

      public Real getE4()
    • getE5

      public Real getE5()
    • getE6

      public Real getE6()
    • getE7

      public Real getE7()
    • real

      public Real real()
      Returns the real part (e0).
    • norm

      public Real norm()
      Returns the norm (magnitude) of this octonion.
    • normSquared

      public Real normSquared()
      Returns the squared norm.
    • conjugate

      public Octonion conjugate()
      Returns the conjugate of this octonion.
    • negate

      public Octonion negate()
      Returns the negation of this octonion.
    • plus

      public Octonion plus(Octonion o)
      Adds another octonion to this one.
    • minus

      public Octonion minus(Octonion o)
      Subtracts another octonion from this one.
    • times

      public Octonion times(double s)
      Multiplies this octonion by a scalar.
    • divides

      public Octonion divides(double s)
      Divides this octonion by a scalar.
    • divides

      public Octonion divides(Real sr)
    • times

      public Octonion times(Octonion o)
      Multiplies this octonion by another using the Cayley-Dickson construction. Note: Octonion multiplication is NOT associative!
    • inverse

      public Octonion inverse()
      Returns the multiplicative inverse of this octonion.
    • divides

      public Octonion divides(Octonion o)
      Divides this octonion by another. Note: Since octonions are non-associative, left and right division differ. This implements right division: a / b = a * b^(-1)
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • operate

      public Octonion operate(Octonion left, Octonion right)
      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<Octonion>
      Parameters:
      left - the first operand
      right - the second operand
      Returns:
      the result of a ∗ b
      See Also:
    • add

      public Octonion add(Octonion left, Octonion right)
      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<Octonion>
      Parameters:
      left - the first addend
      right - the second addend
      Returns:
      a + b
    • subtract

      public Octonion subtract(Octonion left, Octonion right)
      Description copied from interface: AbelianGroup
      Returns the difference of two elements.

      Defined as: a - b = a + (-b)

      Specified by:
      subtract in interface AbelianGroup<Octonion>
      Parameters:
      left - the minuend
      right - the subtrahend
      Returns:
      a - b
      See Also:
    • multiply

      public Octonion multiply(Octonion left, Octonion right)
      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<Octonion>
      Parameters:
      left - the first factor
      right - the second factor
      Returns:
      a × b
    • zero

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

      Delegates to AbelianMonoid.identity().

      Specified by:
      zero in interface AbelianMonoid<Octonion>
      Returns:
      the zero element
    • one

      public Octonion 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<Octonion>
      Returns:
      the multiplicative identity
    • negate

      public Octonion negate(Octonion 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<Octonion>
      Parameters:
      element - the element to negate
      Returns:
      -element
      See Also:
    • inverse

      public Octonion inverse(Octonion 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<Octonion>
      Specified by:
      inverse in interface Group<Octonion>
      Parameters:
      element - the element to invert (must be non-zero)
      Returns:
      the multiplicative inverse
      See Also:
    • isMultiplicationCommutative

      public boolean isMultiplicationCommutative()
      Description copied from interface: Field
      Fields always have commutative multiplication.
      Specified by:
      isMultiplicationCommutative in interface Field<Octonion>
      Specified by:
      isMultiplicationCommutative in interface Semiring<Octonion>
      Returns:
      always true
    • 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<Octonion>
      Returns:
      the characteristic (0 for infinite fields, p for finite fields)
    • 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<Octonion>
      Returns:
      a description of this set
    • 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<Octonion>
      Returns:
      true if this set is empty
    • contains

      public boolean contains(Octonion 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<Octonion>
      Parameters:
      element - the element to test for membership
      Returns:
      true if this set contains the element, false otherwise
      See Also: