# The uniform distribution

### 8.4.2 The uniform distribution

#### The probability density function for the uniform distribution: uniform uniformd

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.

Input:

uniform(2.2,3.5,2.8)

Output:

0.769230769231

#### The cumulative distribution function for the uniform distribution: uniform_cdf uniformd_cdf

The uniform_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.

- Input:
  uniform_cdf(2,4,3.2)
  Output:

  0.6

- Input:
  uniform_cdf(2,4,3,3.2)
  Output:

  0.1

#### The inverse distribution function for the uniform distribution: uniform_icdf uniformd_icdf

The uniform_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.

Input:

uniform_icdf(2,3,.6)

Output:

2.6