AbsoluteFuzz

com.phasmidsoftware.number.core.numerical.AbsoluteFuzz
See theAbsoluteFuzz companion object
case class AbsoluteFuzz[T](magnitude: T, shape: Shape)(using evidence$1: HasValue[T]) extends Fuzziness[T]

Absolute Fuzziness.

Type parameters

T

the underlying type of the fuzziness. Usually Double for fuzzy numerics.

Value parameters

magnitude

the magnitude of the fuzz.

shape

the shape of the fuzz.

Attributes

Companion
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Fuzziness[T]
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def *(convolute: Fuzziness[T], independent: Boolean): Fuzziness[T]

Convolves the current instance of Fuzziness[T] with another Fuzziness[T] instance based on the specified parameters, producing a new Fuzziness[T] instance. The behavior of the convolution depends on the shape and magnitude of the Fuzziness[T] instances involved.

Convolves the current instance of Fuzziness[T] with another Fuzziness[T] instance based on the specified parameters, producing a new Fuzziness[T] instance. The behavior of the convolution depends on the shape and magnitude of the Fuzziness[T] instances involved.

Value parameters

convolute

The Fuzziness[T] instance to convolve with the current instance.

independent

A boolean indicating whether the two fuzzy distributions are independent.

Attributes

Returns

A new Fuzziness[T] instance as the result of the convolution operation.

Throws
FuzzyNumberException

If the operation involves incompatible styles of fuzzy distributions.

def getQualifiedString(t: T, forceScientific: Boolean = ...): (Boolean, String)

Method to render this Fuzziness according to the nominal value t. NOTE that we are actually embedding the fuzziness into the nominal value and returning that.

Method to render this Fuzziness according to the nominal value t. NOTE that we are actually embedding the fuzziness into the nominal value and returning that.

CONSIDER cleaning this method up a bit.

Value parameters

forceScientific

if true, always use scientific notation regardless of value magnitude.

t

a T value.

Attributes

Returns

a tuple of a Boolean (indicating if the value is embedded in the result) and a String which is the textual rendering of t with this Fuzziness applied.

def normalize(t: T, relativeStyle: Boolean): Option[Fuzziness[T]]

Return either a RelativeFuzz equivalent or this, according to relativeStyle.

Return either a RelativeFuzz equivalent or this, according to relativeStyle.

Value parameters

relativeStyle

if true then convert to Absolute otherwise wrap this in Some().

t

the magnitude of the relevant Number.

Attributes

Returns

the (optional) Fuzziness as a Relative or Absolute Fuzziness, according to relative.

def relative(t: T): Option[RelativeFuzz[T]]

This method takes a value of T on which to base a relative fuzz value. NOTE: if t is zero, we will return None, which means the conversion to relative form failed. The caller should keep the original absolute fuzz rather than treating this as an exact number.

This method takes a value of T on which to base a relative fuzz value. NOTE: if t is zero, we will return None, which means the conversion to relative form failed. The caller should keep the original absolute fuzz rather than treating this as an exact number.

Value parameters

t

the nominal value of the fuzzy number.

Attributes

Returns

an optional RelativeFuzz[T]

def round(x: Double, n: Int): Double

Method to do accurate rounding of Double.

Method to do accurate rounding of Double.

Value parameters

n

the number of places to be rounded to.

x

the double value to be rounded.

Attributes

Returns

the rounded value of x.

def thresholdConfidence(x: Double): Double

Computes a threshold confidence value for the given input x based on a normalized Gaussian distribution.

Computes a threshold confidence value for the given input x based on a normalized Gaussian distribution.

The calculation is implemented by asserting the shape is Gaussian, then using normalizeShape.shape to determine the threshold confidence value while factoring in the magnitude as a scale parameter. This method leverages the thresholdConfidence implementation specific to the Gaussian shape.

Value parameters

x

the input value for which the threshold confidence is to be calculated; must be a non-negative value.

Attributes

Returns

the threshold confidence as a Double value, derived from the input x and the magnitude of the instance. The returned value represents the confidence level corresponding to the specific threshold.

def transform[U : HasValue, V : HasValue](func: T => V)(t: T): Fuzziness[U]

Transform this Fuzziness[T] according to func. Typically, func will be the derivative of the relevant Number function.

Transform this Fuzziness[T] according to func. Typically, func will be the derivative of the relevant Number function.

Value parameters

func

the function to apply to this Fuzziness[T].

Attributes

Returns

an (optional) transformed version of Fuzziness[T].

def wiggle(confidence: Double = ...): T

Determine the range +- t such that the probability of a random point being within that range is p, and where magnitude signifies the extent of the PDF. In other words get the wiggle room. NOTE that the greater the value of p, the smaller the result

Determine the range +- t such that the probability of a random point being within that range is p, and where magnitude signifies the extent of the PDF. In other words get the wiggle room. NOTE that the greater the value of p, the smaller the result

Attributes

Inherited methods

def noFuzz[U >: T : HasValue]: Fuzziness[U]

Creates a Fuzziness instance with an absolute fuzz value of zero, using a Gaussian distribution. This can be used to represent the absence of fuzziness or uncertainty in a value.

Creates a Fuzziness instance with an absolute fuzz value of zero, using a Gaussian distribution. This can be used to represent the absence of fuzziness or uncertainty in a value.

Attributes

Returns

a Fuzziness[U] instance with zero fuzziness and Gaussian shape.

Inherited from:
Fuzziness
def probability(l: Double, x: Double): Double

Computes the probability that random points will be found with the range -x to +x where l is a measure of the magnitude of this Fuzziness. TODO change the types of l and x to be T

Computes the probability that random points will be found with the range -x to +x where l is a measure of the magnitude of this Fuzziness. TODO change the types of l and x to be T

Value parameters

l

the size or scale of the probability density function (e.g., standard deviation for a Gaussian distribution).

x

the specific point that bounds the region we're interested in.

Attributes

Returns

the calculated probability density at the given point.

Inherited from:
Fuzziness
def probabilityOfZero(x: Double): Double

Returns the probability that a number with this fuzz and nominal value x is actually zero, i.e. the probability mass at or beyond |x| from the center.

Returns the probability that a number with this fuzz and nominal value x is actually zero, i.e. the probability mass at or beyond |x| from the center.

Value parameters

x

the nominal (absolute) value of the number

Attributes

Returns

probability in [0, 1], where 1.0 means x is certainly zero and 0.0 means x is certainly non-zero

Inherited from:
Fuzziness
def productElementNames: Iterator[String]

An iterator over the names of all the elements of this product.

An iterator over the names of all the elements of this product.

Attributes

Inherited from:
Product
def productIterator: Iterator[Any]

An iterator over all the elements of this product.

An iterator over all the elements of this product.

Attributes

Returns

in the default implementation, an Iterator[Any]

Inherited from:
Product
def uncertainty[U >: T : HasValue](u: U): Fuzziness[U]

Creates a fuzziness value using the given input magnitude and applies a Gaussian distribution. This is intended for the situation where we evaluate a series of terms until the remaining terms are smaller than some threshold (the magnitude). CONSIDER in general, we may want to apply a safety factor of 2 or 3 here.

Creates a fuzziness value using the given input magnitude and applies a Gaussian distribution. This is intended for the situation where we evaluate a series of terms until the remaining terms are smaller than some threshold (the magnitude). CONSIDER in general, we may want to apply a safety factor of 2 or 3 here.

Value parameters

u

the magnitude of the input value used to compute fuzziness.

Attributes

Returns

a Fuzziness[Double] instance representing the absolute fuzziness with Gaussian distribution.

Inherited from:
Fuzziness

Concrete fields

lazy val asPercentage: String

A variation on toString where we render this Fuzziness as a percentage.

A variation on toString where we render this Fuzziness as a percentage.

Attributes

Returns

a String which ends with the '%' character (provided that this Fuzziness is relative).

lazy val normalizeShape: Fuzziness[T]

This method normalizes the shape of the current Fuzziness[T]. If the shape is Gaussian, it returns the current instance. If the shape is Box, it converts the shape to a Gaussian with the same magnitude.

This method normalizes the shape of the current Fuzziness[T]. If the shape is Gaussian, it returns the current instance. If the shape is Box, it converts the shape to a Gaussian with the same magnitude.

Attributes

Returns

a Fuzziness[T] object with a normalized Gaussian shape.

val style: Boolean

False.

False.

Attributes