Trapezoid

com.phasmidsoftware.number.core.numerical.Trapezoid
case class Trapezoid(a: Double, b: Double) extends Shape

A trapezoidal probability distribution, arising from the convolution of two Box distributions. The flat top has half-width (b-a) and the ramps extend to (a+b). NOTE: unlike Box and Gaussian which are case objects with l passed as a parameter to wiggle, Trapezoid carries its own scale parameters a and b. The l parameter of wiggle and probability is therefore ignored. TODO: at some future point, refactor Box and Gaussian similarly, moving l into the case class/object.

Value parameters

a

the half-width of the smaller of the two constituent Box distributions (a <= b).

b

the half-width of the larger of the two constituent Box distributions.

Attributes

Graph
Supertypes
trait Serializable
trait Product
trait Equals
trait Shape
class Object
trait Matchable
class Any
Show all

Members list

Value members

Concrete methods

def effectiveMagnitude(l: Double): Double

Calculates the effective magnitude of the trapezoid based on the given parameter. The calculation leverages the sigma field of the trapezoid.

Calculates the effective magnitude of the trapezoid based on the given parameter. The calculation leverages the sigma field of the trapezoid.

Value parameters

l

(ignored)

Attributes

Returns

the effective magnitude as a double value, derived from the trapezoid's characteristics.

def probability(l: Double, x: Double): Double

Computes the probability that a random point falls within [-x, x]. NOTE: the l parameter is ignored since scale is encoded in a and b.

Computes the probability that a random point falls within [-x, x]. NOTE: the l parameter is ignored since scale is encoded in a and b.

Value parameters

l

ignored.

x

the half-width of the region of interest.

Attributes

Returns

the probability.

def thresholdConfidence(x: Double, l: Double): Double

Convert this Trapezoid to an equivalent Gaussian AbsoluteFuzz. Used when further convolution is required (n >= 3 Box distributions).

Convert this Trapezoid to an equivalent Gaussian AbsoluteFuzz. Used when further convolution is required (n >= 3 Box distributions).

Attributes

def wiggle(l: Double, confidence: Double): Double

Computes a value based on the given confidence level. The method distinguishes between two regions: a flat-top region where the result is independent of confidence, and a ramp region where the result depends on confidence. Special cases are handled for confidence values of 0.0 and 1.0. NOTE: the l parameter is ignored since scale is encoded in a and b.

Computes a value based on the given confidence level. The method distinguishes between two regions: a flat-top region where the result is independent of confidence, and a ramp region where the result depends on confidence. Special cases are handled for confidence values of 0.0 and 1.0. NOTE: the l parameter is ignored since scale is encoded in a and b.

Value parameters

confidence

a value between 0.0 and 1.0 representing the level of certainty or probability.

l

a parameter intended for use in computations (currently not utilized).

Attributes

Returns

a computed double value based on the given confidence level.

Inherited methods

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

Concrete fields

val sigma: Double

The standard deviation of this Trapezoid distribution, derived from the sum of variances of the two constituent Box distributions: Var = a²/3 + b²/3 = (a²+b²)/3.

The standard deviation of this Trapezoid distribution, derived from the sum of variances of the two constituent Box distributions: Var = a²/3 + b²/3 = (a²+b²)/3.

Attributes