RelativeFuzz

com.phasmidsoftware.number.core.numerical.RelativeFuzz
case class RelativeFuzz[T](tolerance: Double, shape: Shape)(using evidence$1: HasValue[T]) extends Fuzziness[T]

Relative fuzziness.

Type parameters

T

the underlying type of the fuzziness. Usually Double for fuzzy numerics [must have HasValue].

Value parameters

shape

the shape (Uniform, Gaussian, etc.)

tolerance

the error bound.

Attributes

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]

Perform a convolution on this Fuzziness[T] with the given addend. This operation is suitable for multiplication of Numbers.

Perform a convolution on this Fuzziness[T] with the given addend. This operation is suitable for multiplication of Numbers.

Value parameters

convolute

the convolute, which must have the same shape as this.

independent

true if the distributions are independent.

Attributes

Returns

the convolution of this and the convolute.

def absolute(t: T): Option[AbsoluteFuzz[T]]

This method takes a value of T on which to base a relative fuzz value.

This method takes a value of T on which to base a relative fuzz value.

Value parameters

t

the nominal value of the fuzzy number.

Attributes

Returns

an optional RelativeFuzz[T]

def asPercentage: String

A variation on toString where we render this relative Fuzziness as a percentage. Trailing zeros are stripped (e.g. "0.5%" not "0.50%", "2%" not "2.0%").

A variation on toString where we render this relative Fuzziness as a percentage. Trailing zeros are stripped (e.g. "0.5%" not "0.50%", "2%" not "2.0%").

Attributes

Returns

a String which ends with the '%' character.

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

Render this Fuzziness as with a given T value.

Render this Fuzziness as with a given T value.

Value parameters

t

the T value.

Attributes

Returns

a String which is the textual rendering of t with this Fuzziness applied.

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

Return either an AbsoluteFuzz equivalent or this, according to relative.

Return either an AbsoluteFuzz equivalent or this, according to relative.

Value parameters

relative

if true then convert to RelativeFuzz 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 thresholdConfidence(x: Double): Double

Computes the threshold confidence value for a given input based on the shape of the distribution. The distribution shape is assumed to be Gaussian, and it uses the absolute value of the input along with a predefined tolerance to calculate the result.

Computes the threshold confidence value for a given input based on the shape of the distribution. The distribution shape is assumed to be Gaussian, and it uses the absolute value of the input along with a predefined tolerance to calculate the result.

Value parameters

x

the input value for which the threshold confidence is calculated. It is expected to be a double precision number.

Attributes

Returns

the threshold confidence as a Double, representing the probability/confidence threshold determined by the Gaussian shape.

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.

Type parameters

U

the underlying type of the result.

V

the type of the quotient of T/U.

Value parameters

func

the function to apply to this Fuzziness[T].

t

the value of t (i.e., the input value) which will be passed into func.

Attributes

Returns

a transformed version of Fuzziness[U].

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 tolerance 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 tolerance 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

Value parameters

confidence

the confidence we wish to have in the result: typical value: oneSigma

Attributes

Returns

the value of t at which the probability density is exactly transitions from likely to not likely.

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 normalizeShape: Fuzziness[T]

Yield a Fuzziness[T] that is Gaussian (either this or derivative of this).

Yield a Fuzziness[T] that is Gaussian (either this or derivative of this).

Attributes

val style: Boolean

True.

True.

Attributes