Represents a fuzzy number, combining a numeric value with a level of fuzziness.
A fuzzy number encapsulates imprecision or uncertainty alongside its value, and supports arithmetic operations and algebraic structure integration. Fuzzy numbers are useful in computational scenarios involving uncertainty, approximate calculations, or tolerances. This object provides factory methods, constants, and implicit type class instances for working with fuzzy numbers.
Attributes
Members list
Type members
Classlikes
Represents an immutable instance of positive infinity as a Real.
Represents an immutable instance of positive infinity as a Real.
Infinity is a predefined object within the Real class hierarchy that symbolizes the mathematical concept of positive infinity. It is constructed using Double.PositiveInfinity as the underlying representation and does not associate any fuzziness with its value.
This object can be used in computations requiring an explicit representation of positive infinity.
Attributes
- See also
- Supertypes
-
class Realtrait Serializabletrait Producttrait Equalstrait MaybeFuzzytrait CanMultiplyAndDivide[Real]trait CanAddAndSubtract[Real]trait Rtrait Numbertrait Ordered[Scalar]trait Comparable[Scalar]trait Scalartrait Structuretrait WithFuzzinesstrait Eagertrait DyadicOpstrait Approximatetrait Valuabletrait TypeSafetrait Normalizable[Valuable]trait Exactitudetrait Unitarytrait Zeroabletrait Numerictrait Renderableclass Objecttrait Matchableclass AnyShow all
- Self type
-
Infinity.type
A given instance of the Convertible typeclass for transforming an instance of type Angle into a Real using a conversion operation.
A given instance of the Convertible typeclass for transforming an instance of type Angle into a Real using a conversion operation.
This implementation creates a new Real by extracting the numerical value from the Angle instance and wrapping it within the Real type.
Value parameters
- u
-
the source
Angleinstance to be converted into aReal - witness
-
an instance of type
Real, representing additional context for the conversion
Attributes
- Returns
-
a new
Realinstance containing the numerical value derived from the inputAngle - Supertypes
- Self type
Provides a given instance of the Convertible typeclass to enable conversion from an instance of RationalNumber to an instance of Real.
Provides a given instance of the Convertible typeclass to enable conversion from an instance of RationalNumber to an instance of Real.
This given instance defines a concrete implementation of the convert method that transforms a RationalNumber into a Real by utilizing the toDouble method of the RationalNumber class. The convert method takes a Real witness object (serving as a prototype for the conversion) and a RationalNumber to be converted.
The resulting Real is constructed using the numeric value of the RationalNumber (converted to a Double) and the default fuzziness of the Real.
Attributes
- Supertypes
- Self type
Given instance of Convertible for converting a value of type Real into another value of type Real.
Given instance of Convertible for converting a value of type Real into another value of type Real.
This implementation of Convertible performs an identity operation, where the given input value is returned as-is without any modifications.
Type parameters
- Real
-
the target and source type for conversion
Attributes
- Supertypes
- Self type
A given instance of the Convertible typeclass that provides a conversion from WholeNumber to Real.
A given instance of the Convertible typeclass that provides a conversion from WholeNumber to Real.
The conversion is performed by taking the WholeNumber value, converting it to a Double, and then constructing a Real instance using the converted value.
This implementation assumes that the Real type represents a numerical value with support for double-precision, and the WholeNumber type represents an integer-like structure.
Attributes
- Supertypes
- Self type
Provides an implicit implementation of the Ring typeclass for the Real type.
Provides an implicit implementation of the Ring typeclass for the Real type.
This object supports arithmetic operations (addition, multiplication, and negation) and the retrieval of constants (zero and one) for the Real type, thus conforming to the requirements of the Ring algebraic structure.
CONSIDER extending Semiring instead (Claude feels that it would be appropriate for fuzzy numbers), but I don't have a problem with the additive (or multiplicative) inverse.
Attributes
- Supertypes
-
trait Ordering[Real]trait PartialOrdering[Real]trait Equiv[Real]trait Comparator[Real]trait Ring[Real]trait Rng[Real]trait AdditiveCommutativeGroup[Real]trait AdditiveGroup[Real]trait Rig[Real]trait MultiplicativeMonoid[Real]trait Semiring[Real]trait MultiplicativeSemigroup[Real]trait AdditiveCommutativeMonoid[Real]trait AdditiveCommutativeSemigroup[Real]trait AdditiveMonoid[Real]trait AdditiveSemigroup[Real]trait Serializableclass Objecttrait Matchableclass AnyShow all
- Self type
-
realIsRing.type
Value members
Concrete methods
Constructs a Real instance using the given long value and no fuzziness.
Constructs a Real instance using the given long value and no fuzziness.
This method converts the specified long value to a double and delegates to the corresponding method apply(value: Double, fuzziness: Option[Fuzziness[Double]]) to construct the Real instance.
Value parameters
- value
-
the long value to be associated with the
Real
Attributes
- Returns
-
a
Realinstance initialized with the given value (converted to double) and default fuzziness
Constructs a Real with the given numeric value and a default fuzziness level.
Constructs a Real with the given numeric value and a default fuzziness level.
This method creates a Real instance using the provided value and a default level of fuzziness based on double-precision.
Value parameters
- value
-
the numeric value to be associated with the
Real
Attributes
- Returns
-
a
Realinstance initialized with the specified value and default fuzziness
Constructs a Real instance using the provided value and absolute fuzziness.
Constructs a Real instance using the provided value and absolute fuzziness.
This method creates a Real object with the specified numeric value and an absolute fuzziness level that adjusts the precision of computations involving this instance.
Value parameters
- fuzz
-
the absolute fuzziness level to be applied to the
Real - value
-
the numeric value to be associated with the
Real
Attributes
- Returns
-
a
Realinstance initialized with the specified value and fuzziness
Constructs a Real instance using the numerical value and optional fuzziness of a given numericalReal instance.
Constructs a Real instance using the numerical value and optional fuzziness of a given numericalReal instance.
This method extracts a double-precision value and an optional fuzziness level from the input numericalReal, and creates a new Real instance initialized with those parameters.
Value parameters
- x
-
the input
numericalRealinstance, providing the value and optional fuzziness for the newReal
Attributes
- Returns
-
a
Realinstance initialized with the value and fuzziness derived from the inputnumericalReal
Constructs a Real instance with a specified numeric value and optional fuzziness.
Constructs a Real instance with a specified numeric value and optional fuzziness.
This method creates a Real object using the
Attributes
Parses a string representation of a number and constructs a Real instance. If the input string cannot be parsed into a valid number, a AlgebraException is thrown.
Parses a string representation of a number and constructs a Real instance. If the input string cannot be parsed into a valid number, a AlgebraException is thrown.
NOTE this deprecation is OK--there is no alternative NumberParser
Value parameters
- w
-
the input string to be parsed and converted into a
Realinstance
Attributes
- Returns
-
a
Realinstance constructed from the parsed numeric value of the input string
Constructs a new Real instance based on the values of an existing Real.
Constructs a new Real instance based on the values of an existing Real.
This method takes a Real instance as an input and creates a new Real with the same numerical value but potentially adjusted fuzziness.
Value parameters
- real
-
the input
Realused to initialize the newRealinstance
Attributes
- Returns
-
a
Realinstance initialized with the value of the inputReal
Concrete fields
Represents a mathematical concept of positive infinity as a Real value.
Represents a mathematical concept of positive infinity as a Real value.
The symbol ∞ is predefined as a Real instance, initialized to Double.PositiveInfinity with no associated fuzziness. It serves to denote a value that is unbounded in the positive direction within the context of real numbers.
Attributes
Returns a Real representing the value one with double precision fuzziness.
Returns a Real representing the value one with double precision fuzziness.
Attributes
- Returns
-
a
Realinstance initialized with the numeric value 1 and a default level of fuzziness.
Returns a Real representing the mathematical constant π (pi) with a default level of fuzziness.
Returns a Real representing the mathematical constant π (pi) with a default level of fuzziness.
Attributes
- Returns
-
a
Realinitialized with the value of π and the default fuzziness level
Creates a Real instance with a value of 0 and a default fuzziness level.
Creates a Real instance with a value of 0 and a default fuzziness level.
Attributes
- Returns
-
a
Realrepresenting the value zero with default fuzziness
Represents the mathematical concept of infinity within the Real class.
Represents the mathematical concept of infinity within the Real class.
This value is an alias for the predefined infinity constant in the Real class, which signifies a positive infinite quantity. It is typically used in calculations or scenarios where an infinitely large value is required or represented.
Attributes
Represents the Euler-Mascheroni constant, denoted as 𝛾.
Represents the Euler-Mascheroni constant, denoted as 𝛾.
This value is instantiated as a Real and corresponds to the mathematical constant that characterizes the difference between the harmonic series and the natural logarithm. It is widely used in various branches of mathematics including number theory, analysis, and special functions.
Attributes
Givens
Givens
A given instance of the Convertible typeclass for transforming an instance of type Angle into a Real using a conversion operation.
A given instance of the Convertible typeclass for transforming an instance of type Angle into a Real using a conversion operation.
This implementation creates a new Real by extracting the numerical value from the Angle instance and wrapping it within the Real type.
Value parameters
- u
-
the source
Angleinstance to be converted into aReal - witness
-
an instance of type
Real, representing additional context for the conversion
Attributes
- Returns
-
a new
Realinstance containing the numerical value derived from the inputAngle
Provides a given instance of the Convertible typeclass to enable conversion from an instance of RationalNumber to an instance of Real.
Provides a given instance of the Convertible typeclass to enable conversion from an instance of RationalNumber to an instance of Real.
This given instance defines a concrete implementation of the convert method that transforms a RationalNumber into a Real by utilizing the toDouble method of the RationalNumber class. The convert method takes a Real witness object (serving as a prototype for the conversion) and a RationalNumber to be converted.
The resulting Real is constructed using the numeric value of the RationalNumber (converted to a Double) and the default fuzziness of the Real.
Attributes
Given instance of Convertible for converting a value of type Real into another value of type Real.
Given instance of Convertible for converting a value of type Real into another value of type Real.
This implementation of Convertible performs an identity operation, where the given input value is returned as-is without any modifications.
Type parameters
- Real
-
the target and source type for conversion
Attributes
A given instance of the Convertible typeclass that provides a conversion from WholeNumber to Real.
A given instance of the Convertible typeclass that provides a conversion from WholeNumber to Real.
The conversion is performed by taking the WholeNumber value, converting it to a Double, and then constructing a Real instance using the converted value.
This implementation assumes that the Real type represents a numerical value with support for double-precision, and the WholeNumber type represents an integer-like structure.
Attributes
Implicit implementation of the DyadicOperator trait for the Real type. This operator allows performing dyadic operations on instances of Real and its subtypes using a provided function f that specifies the operation.
Implicit implementation of the DyadicOperator trait for the Real type. This operator allows performing dyadic operations on instances of Real and its subtypes using a provided function f that specifies the operation.
Attributes
- Returns
-
A
DyadicOperator[Real]that applies the given operationfto two operands ofRealand its subtypes, encapsulating the result in aTry.
Provides an instance of Eq for the Real type, enabling equality comparison between Real instances.
Provides an instance of Eq for the Real type, enabling equality comparison between Real instances.
This instance defines the equality operation for Real values by using their eqv method, which checks for equivalence. If the equivalence check returns None, it defaults to false.
Attributes
- Returns
-
an instance of
Eq[Real]for comparingRealinstances
Defines a given instance of the FuzzyEq type class for the Real type.
Defines a given instance of the FuzzyEq type class for the Real type.
This instance provides a fuzzy equality implementation for Real numbers. Two Real instances are considered fuzzily equal if they are strictly equal or if their fuzzy equality (with respect to a specified probability p) evaluates to true.
Attributes
- Returns
-
A
FuzzyEq[Real]instance enabling fuzzy equality comparisons forReal.
Implicits
Implicits
Provides an implicit instance of Show for the Real type.
Provides an implicit instance of Show for the Real type.
This implementation defines how instances of Real are converted to a human-readable string representation by invoking their render method.
It enables seamless integration with type classes requiring a Show instance, allowing Real objects to be printed or logged in a human-readable format.