Skip to content

TriangularDistribution ​

The triangular distribution on [a,b][a,b] with mode cc (defaulting to the midpoint).

TriangularDistribution({a, b})mode defaults to the midpoint (a+b)/2(a+b)/2.
TriangularDistribution({a, b}, c)mode given explicitly.
Typed signatures
TypePackageApplies
(list<real>, real?) -> distributionstatisticsalways

Domain: Statistics

Details
  • PDF(x)=2(x−a)/((b−a)(c−a))PDF(x) = 2(x-a)/((b-a)(c-a)) for x<cx < c, 2(b−x)/((b−a)(b−c))2(b-x)/((b-a)(b-c)) otherwise — no boundary clamp against aa or bb (a documented divergence).
  • CDFCDF is the corresponding piecewise quadratic.
  • Mean=(a+b+c)/3Mean = (a+b+c)/3, Variance=(a2+b2+c2−ab−ac−bc)/18Variance = (a^2+b^2+c^2-ab-ac-bc)/18, both exact.
  • RandomVariate samples via inverse transform.

Examples

Basic #
live ↗
InPDF⁡(TriangularDistribution([0,1]),14)\operatorname{PDF}(\mathrm{TriangularDistribution}(\bigl\lbrack0, 1\bigr\rbrack), \frac{1}{4})Out11
live ↗
InCDF⁡(TriangularDistribution([0,1]),14)\operatorname{CDF}(\mathrm{TriangularDistribution}(\bigl\lbrack0, 1\bigr\rbrack), \frac{1}{4})Out18\frac{1}{8}
live ↗
Inmean(TriangularDistribution([0,1]))\mathrm{mean}(\mathrm{TriangularDistribution}(\bigl\lbrack0, 1\bigr\rbrack))Out12\frac{1}{2}
live ↗
InVariance(TriangularDistribution([0,1]))\mathrm{Variance}(\mathrm{TriangularDistribution}(\bigl\lbrack0, 1\bigr\rbrack))Out124\frac{1}{24}
About
Examples4

See also: DiscreteUniformDistribution, PDF, CDF