### 20.4.2 Uniform distribution

##### The probability density function for the uniform distribution.

Given two values a and b with a < b, the uniform distribution on [a,b] has density function 1/(b−a) for x in [a,b]. The uniform (or uniformd) command computes this density function.

- uniform (or uniformd) takes three arguments:
  - a and b, real numbers with a<b.
  - x, a real number.
- uniform(a,b,x) (or uniformd(a,b,x)) returns the value of the probability density function for the uniform distribution from a to b, namely 1/(b−a).

#### Example

uniform(2.2,3.5,2.8)

0.769230769231 |  |  |  |  |  |  |  |  |  |

##### The cumulative distribution function for the uniform distribution.

The uniform_cdf or uniformd_cdf command finds the cumulative distribution function for the uniform distribution.

- uniform_cdf takes three mandatory arguments and one optional argument:
  - a and b, real numbers with a<b.
  - x, a real number.
  - Optionally y, a real number.
- uniform_cdf(a,b,x) returns the value of the cumulative distribution function for the uniform distribution from a to b, which in this case will be (x−a)/(b−a).
- uniform_cdf(a,b,x,y) returns Prob(x ≤ X ≤ y), which in this case will be (y−x)/(b−a).

#### Examples

uniform_cdf(2,4,3.2)

0.6 |  |  |  |  |  |  |  |  |  |

uniform_cdf(2,4,3,3.2)

0.1 |  |  |  |  |  |  |  |  |  |

##### The inverse distribution function for the uniform distribution.

The uniform_icdf or uniformd_icdf command computes the inverse distribution for the uniform distribution.

- uniform_icdf takes three arguments:
  - a and b, real numbers with a<b.
  - h, a real number between 0 and 1.
- uniform_icdf(a,b,h) returns the value of the inverse distribution function to the uniform distribution from a to b; namely the value of x for which h=Prob(X ≤ x).

#### Example

uniform_icdf(2,3,.6)

2.6 |  |  |  |  |  |  |  |  |  |