# Triangular10 50 90

## Triangular_10_50_90(p10, p50, p90)

This defines a trianglar distribution given percentiles *p10 ≤ p50 ≤ p90*.

There are a couple downsides of defining a triangular distribution using percentiles, rather than using «min»-«mode»-«max» as is done with the built-in Triangular distribution function. First, the percentiles do not always uniquely specify the triangular distribution. When *p10* and *p90* are on opposite sides of the mode, there are often two possible triangular distributions with the indicated fractiles, and when *p10* and *p90* are on the same side of the mode, there is a fully unconstrained degree of freedom, leading to an infinite number of triangular distributions matching the fractiles. In these cases, this function will select one of the possible consistent distributions.

In addition to non-uniqueness, there are some combinations of *p10 ≤ p50 ≤ p90* that have no triangular distribution with the indicated percentiles. This may occur when *p50-p10 << p90-p50* or *p50-p10 >> p90-p50* (where << means *much* less than). In this case, an error results. You can suppress this error by setting the optional «noErr» parameter to false, e.g.:

`Triangular_10_50_90(a, b, c, noErr: true)`

in which case a triangular distribution not precisely matching the indicated *p10*, *p50* and *p90* percentiles (but usually fairly close) is returned.

## Library

Distribution Variations library (Distribution Variations.ana)

- Use
**File → Add Library...**to add this library

Enable comment auto-refresher