FuzzyNumber

com.phasmidsoftware.number.core.numerical.FuzzyNumber
See theFuzzyNumber companion class
object FuzzyNumber

The FuzzyNumber companion object provides operations and utilities for working with fuzzy numbers, enabling probabilistic and inexact computations. It includes methods for comparison, arithmetic, and adding fuzziness to numbers.

Attributes

Companion
class
Graph
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type

Members list

Type members

Classlikes

object NumberIsFuzzy extends Fuzzy[Number]

Definition of concrete (implicit) type class object for FuzzyNumber being Fuzzy.

Definition of concrete (implicit) type class object for FuzzyNumber being Fuzzy.

Attributes

Supertypes
trait Fuzzy[Number]
class Object
trait Matchable
class Any
Self type

Inherited and Abstract types

type MirroredElemLabels <: Tuple

The names of the product elements.

The names of the product elements.

Attributes

Inherited from:
Mirror
type MirroredLabel <: String

The name of the type.

The name of the type.

Attributes

Inherited from:
Mirror

Value members

Concrete methods

def addFuzz(n: Number, f: Fuzziness[Double]): Number

Method to add fuzz to a FuzzyNumber.

Method to add fuzz to a FuzzyNumber.

Value parameters

f

the fuzziness to be added.

n

the Number to be fuzzied.

Attributes

Returns

a fuzzied version of n.

def apply(nominalValue: Value, factor: Factor, fuzz: Option[Fuzziness[Double]]): FuzzyNumber

Constructs a new FuzzyNumber based on the provided nominal value, factor, and optional fuzziness. Applies specific logic to determine how fuzziness impacts the nominal value.

Constructs a new FuzzyNumber based on the provided nominal value, factor, and optional fuzziness. Applies specific logic to determine how fuzziness impacts the nominal value.

Value parameters

factor

the Factor associated with the FuzzyNumber, which may influence its properties or behavior.

fuzz

an optional Fuzziness[Double] representing uncertainty or variability around the nominal value. If defined, it may modify the resulting instance based on internal criteria.

nominalValue

the central value of the FuzzyNumber, represented as a Value.

Attributes

Returns

a new instance of FuzzyNumber that encapsulates the provided parameters and applies any necessary adjustments for fuzziness.

def apply(): Number

Method to construct an invalid Number.

Method to construct an invalid Number.

Attributes

Returns

Number.apply()

def fuzzyCompare(x: Number, y: Number, confidence: Double = ...): Int

For fuzzy numbers, it's appropriate to use the the normal mechanism for compare, even for NatLog numbers.

For fuzzy numbers, it's appropriate to use the the normal mechanism for compare, even for NatLog numbers.

NOTE, we first invoke same(p)(x, y) to determine if the Numbers are the same in a canonical manner. However, we could actually skip this step and always just invoke the else part of the expression.

Value parameters

confidence

the probability criterion.

x

the first number.

y

the second number.

Attributes

Returns

an Int representing the order.

def plus(x: FuzzyNumber, y: Number): Number

Method to add a FuzzyNumber and a (general) Number.

Method to add a FuzzyNumber and a (general) Number.

Value parameters

x

a FuzzyNumber.

y

a Number.

Attributes

Returns

the sum of x and y.

def roundToSigFigs(value: Double, sigFigs: Int): String

Round a Double value to the given number of significant figures, returning a String.

Round a Double value to the given number of significant figures, returning a String.

Value parameters

sigFigs

the number of significant figures.

value

the value to round.

Attributes

Returns

a String representation rounded to sigFigs significant figures.

def sigFigsForTolerance(tolerance: Double): Int

Calculate the appropriate number of significant figures to display given a relative tolerance. We show enough figures so the last digit is uncertain — i.e. 1 extra sig fig beyond the uncertainty.

Calculate the appropriate number of significant figures to display given a relative tolerance. We show enough figures so the last digit is uncertain — i.e. 1 extra sig fig beyond the uncertainty.

Value parameters

tolerance

the relative tolerance (e.g. 0.02 for 2%).

Attributes

Returns

the number of significant figures to display (minimum 1).

Method to multiply two Numbers, the first a GeneralNumber.

Method to multiply two Numbers, the first a GeneralNumber.

CONSIDER why do we have this as well as the times method in GeneralNumber? Perhaps the type of x should be FuzzyNumber.

Value parameters

x

a GeneralNumber.

y

a Number.

Attributes

Returns

the product of x and y.