Interface Field<E>
- All Superinterfaces:
AbelianGroup<E>, AbelianMonoid<E>, Group<E>, Magma<E>, Monoid<E>, Ring<E>, Semiring<E>, Set<E>
- All Known Implementing Classes:
Complex, Complexes, DoubleField, NativeRealBig, Octonion, Octonions, Quaternion, Quaternions, Rational, Rationals, Real, RealBig, RealDouble, RealFloat, Reals
A field is a commutative ring where every non-zero element has a
multiplicative inverse.
Fields are algebraic structures where addition, subtraction, multiplication, and division (except by zero) are all well-defined. They are fundamental in mathematics, appearing in linear algebra, number theory, and many applications.
Mathematical Definition
A field (F, +, ×) is a ring satisfying:
- Commutativity of multiplication: a × b = b × a
- Existence of unity: ∃ 1 ∈ F such that 1 × a = a for all a
- Multiplicative inverses: ∀ a ∈ F \ {0}, ∃ a⻹ such that a × a⻹ = 1
Examples
- ℚ - Rational numbers
- â„ - Real numbers
- â„‚ - Complex numbers
- ðÂâ€Â½Ã¢â€šÅ¡ - Integers modulo prime p
- ℚ(√2) - Rationals extended with √2
- â„Â(x) - Rational functions over reals
Not Fields
- ℤ - Integers (no multiplicative inverses: 2⻹ ∉ ℤ)
- Mâ‚‚(â„Â) - 2×2 matrices (not commutative)
- ℤ/6ℤ - Integers mod 6 (zero divisors: 2 × 3 = 0 mod 6)
Usage
- Since:
- 1.0
- Author:
- Silvere Martin-Michiellot, Gemini AI (Google DeepMind)
-
Method Summary
Modifier and TypeMethodDescriptionintReturns the characteristic of this field.default EReturns the quotient of two elements (division).default booleanhasUnity()Fields always have unity (multiplicative identity).Returns the multiplicative inverse of a non-zero element.default booleanFields always have commutative multiplication.Methods inherited from interface AbelianGroup
isCommutative, negate, subtractMethods inherited from interface AbelianMonoid
add, identity, isCommutative, zeroMethods inherited from interface Monoid
isAssociativeMethods inherited from interface Set
contains, description, isEmpty
-
Method Details
-
inverse
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:
inversein interfaceGroup<E>- Parameters:
element- the element to invert (must be non-zero)- Returns:
- the multiplicative inverse
- Throws:
NullPointerException- if element is nullArithmeticException- if element is zero- See Also:
-
divide
Returns the quotient of two elements (division).Defined as: a ÷ b = a × b⻹
- Parameters:
dividend- the dividend (numerator)divisor- the divisor (denominator, must be non-zero)- Returns:
- dividend ÷ divisor
- Throws:
NullPointerException- if either argument is nullArithmeticException- if divisor is zero- See Also:
-
hasUnity
-
isMultiplicationCommutative
default boolean isMultiplicationCommutative()Fields always have commutative multiplication.- Specified by:
isMultiplicationCommutativein interfaceSemiring<E>- Returns:
- always
true
-
characteristic
int characteristic()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)
- Returns:
- the characteristic (0 for infinite fields, p for finite fields)
-