UniformDistribution

UniformDistribution[{min,max}]

represents a continuous uniform statistical distribution giving values between min and max.

UniformDistribution[]

represents a uniform distribution giving values between 0 and 1.

UniformDistribution[{{xmin,xmax},{ymin,ymax},}]

represents a multivariate uniform distribution over the region {{xmin,xmax},{ymin,ymax},}.

UniformDistribution[n]

represents a multivariate uniform distribution over the standard n dimensional unit hypercube.

Details

Background & Context

  • UniformDistribution[{a,b}] represents a statistical distribution (sometimes also known as the rectangular distribution) in which a random variate is equally likely to take any value in the interval . Consequently, the uniform distribution is parametrized entirely by the endpoints of its domain and its probability density function is constant on the interval . The standard uniform distribution, which may be returned using UniformDistribution[], is taken on the interval . The uniform distribution also generalizes to multiple variates, each of which is equally likely on some domain.
  • The inverse transform method, which allows sampling from an arbitrary distribution by applying the inverse of the cumulative distribution function of a target random variable to variates selected from a uniform distribution, is an important application of this distribution. Another important property is that when testing a null hypothesis using a p-value with continuous distribution as a test statistic, the p-value has a standard uniform distribution if the null hypothesis is true.
  • RandomVariate can be used to give one or more machine- or arbitrary-precision (the latter via the WorkingPrecision option) pseudorandom variates from a uniform distribution. Distributed[x,UniformDistribution[{a,b}]], written more concisely as xUniformDistribution[{a,b}], can be used to assert that a random variable x is distributed according to a uniform distribution. Such an assertion can then be used in functions such as Probability, NProbability, Expectation, and NExpectation.
  • The probability density and cumulative distribution functions may be given using PDF[UniformDistribution[{a,b}],x] and CDF[UniformDistribution[{a,b}],x]. The mean, median, variance, raw moments, and central moments may be computed using Mean, Median, Variance, Moment, and CentralMoment, respectively.
  • DistributionFitTest can be used to test if a given dataset is consistent with a uniform distribution, EstimatedDistribution to estimate a uniform parametric distribution from given data, and FindDistributionParameters to fit data to a uniform distribution. ProbabilityPlot can be used to generate a plot of the CDF of given data against the CDF of a symbolic uniform distribution and QuantilePlot to generate a plot of the quantiles of given data against the quantiles of a symbolic uniform distribution.
  • TransformedDistribution can be used to represent a transformed uniform distribution, CensoredDistribution to represent the distribution of values censored between upper and lower values, and TruncatedDistribution to represent the distribution of values truncated between upper and lower values. CopulaDistribution can be used to build higher-dimensional distributions that contain a uniform distribution and ProductDistribution can be used to compute a joint distribution with independent component distributions involving uniform distributions.
  • The uniform distribution is related to a number of other distributions. For example, UniformDistribution[] is a special case of BetaDistribution and PowerDistribution in the sense that (modulo inclusion of the endpoints and ), PDF[UniformDistribution[],x] is equal to both PDF[BetaDistribution[1,1],x] and PDF[PowerDistribution[1,1],x]. The discrete uniform distribution is given by DiscreteUniformDistribution, and UniformSumDistribution generalizes the uniform distribution to the distribution of a sum of random uniform variates. The sum of two independent and equally distributed uniform distributions yields a symmetric TriangularDistribution. If has a standard uniform distribution, then has a BetaDistribution with parameters and 1. The probability distribution of the ^(th)-order statistic for an independent and identically distributed sample from a standard uniform distribution (which can be found using OrderDistribution[{UniformDistribution[],n},k]) is given by BetaDistribution[k,1-k+n], with the corresponding expected value of (which may be computed using Expectation[x,xBetaDistribution[k,1-k+n]]) given by . Other closely related distributions include VonMisesDistribution, LogisticDistribution, WeibullDistribution, LaplaceDistribution, BatesDistribution, and ChiSquareDistribution.

Examples

open allclose all

Basic Examples  (8)

Probability density function of univariate uniform distribution:

Cumulative distribution function of univariate uniform distribution:

Mean and variance of univariate uniform distribution:

Median of univariate uniform distribution:

Probability density function in two dimensions:

Cumulative distribution function in two dimensions:

Mean and variance in two dimensions:

Covariance:

Scope  (11)

Generate a sample of random numbers from a uniform distribution:

Compare its histogram to the PDF:

Distribution parameters estimation:

Estimate the distribution parameters from sample data:

Compare the density histogram of the sample with the PDF of the estimated distribution:

Distribution parameters estimation for multivariate uniform distribution:

Estimate the distribution parameters from sample data:

Skewness and kurtosis are constant in any dimensions:

The components of multivariate uniform distribution are uncorrelated:

Different moments with closed forms as functions of parameters:

Moment:

Closed form for symbolic order:

CentralMoment:

Closed form for symbolic order:

FactorialMoment:

Cumulant:

Closed form for symbolic order:

Different mixed moments for a multivariate uniform distribution:

Closed form for symbolic order:

Mixed central moments:

Closed form for symbolic order:

Mixed factorial moments:

Mixed cumulants:

Closed form for symbolic order:

Hazard function:

Hazard function in two dimensions:

Quantile function:

The marginals of multivariate uniform distribution are uniform distributions:

Consistent use of Quantity in parameters yields QuantityDistribution:

Find the mean area of a rectangle whose height and width are independent and uniformly distributed:

Quantity parameters need only be consistent within each dimension:

Find the mean height and mean weight:

Applications  (12)

Find the probability that a randomly chosen point is in the left part of the interval:

Find the probability that two randomly selected points on a circle create an angle less than :

Generate a uniform distribution of points on a circle:

Obtain a random number from the inverse CDF of a distribution:

The nozzle of a fountain shoots water at speed and angle varying between and with equal probability. Find the expected horizontal distance where water touches the ground:

Sidelength of a random rectangle is uniformly distributed between 10 and 20 meters:

Find the mean area of a rectangle whose height and width are independent and uniformly distributed:

Compare to the mean area of a square whose side is uniformly distributed:

The phase angle of a sinusoidal signal is uniformly distributed from to . Find the probability that is between and :

Find the probability that the phase angle is at most :

Find the average value of :

Find the probability that is within one standard deviation from the average value:

Two trains arrive at a station independently and stay for 10 minutes. If the arrival times are uniformly distributed, find the probability the two trains will meet at the station within one hour:

The region where the two trains meet:

Shafts are produced with their diameter following uniform distribution over independently of the production of shaft housings, the inner diameter of which follows uniform distribution over . Given that the optimal difference between the diameters is up to , find the probability that a shaft will fit into a housing:

Show the shafts in blue and holes in pink:

The lifetime of a device has uniform distribution. Find the reliability of the device:

The hazard function increasing in time:

Find the reliability of two such devices in a series:

Find the reliability of two such devices in parallel:

Compare the reliability of both systems for max1=10 and max2=15:

Show a distribution function and its histogram in the same plot:

Compare the PDF to its histogram version:

Compare the CDF to its histogram version:

Generate white noise that is uniformly distributed between and :

Properties & Relations  (21)

Uniform distribution is closed under scaling and translation:

Assumption on the sign of scale or numeric value is needed:

Truncation:

Relationships to other distributions:

Sum of uniform random variables follows UniformSumDistribution:

For a concrete number of variables:

The mean of uniform variables follows BatesDistribution:

Explicitly compute the PDF:

DiscreteUniformDistribution is the discrete analog of UniformDistribution:

The mean of two uniform random variables follows TriangularDistribution:

Explicitly compute the PDF:

Show using characteristic function:

ExponentialDistribution is the limiting distribution of the where is uniformly distributed:

BetaDistribution is an order distribution of uniformly distributed variables:

BetaDistribution is a transformation of UniformDistribution:

ArcSinDistribution is a transformation of UniformDistribution:

UniformDistribution is a transformation of BetaDistribution:

UniformDistribution is a transformation of KumaraswamyDistribution:

UniformDistribution is a transformation of PowerDistribution:

ChiSquareDistribution is a transformation of UniformDistribution:

LaplaceDistribution is a transformation of UniformDistribution:

LogisticDistribution is a transformation of UniformDistribution:

UniformDistribution is a special case of VonMisesDistribution:

WeibullDistribution is a transformation of UniformDistribution:

WaringYuleDistribution is a parameter mixture of GeometricDistribution and UniformDistribution:

The copula distribution of two univariate uniform distributions is a two-dimensional uniform distribution:

Possible Issues  (2)

UniformDistribution is not defined when either min or max is not a real number:

UniformDistribution is not defined when min max:

Substitution of invalid parameters into symbolic outputs gives results that are not meaningful:

Neat Examples  (1)

PDFs for different max values with CDF contours:

Wolfram Research (2007), UniformDistribution, Wolfram Language function, https://reference.wolfram.com/language/ref/UniformDistribution.html (updated 2016).

Text

Wolfram Research (2007), UniformDistribution, Wolfram Language function, https://reference.wolfram.com/language/ref/UniformDistribution.html (updated 2016).

CMS

Wolfram Language. 2007. "UniformDistribution." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2016. https://reference.wolfram.com/language/ref/UniformDistribution.html.

APA

Wolfram Language. (2007). UniformDistribution. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/UniformDistribution.html

BibTeX

@misc{reference.wolfram_2024_uniformdistribution, author="Wolfram Research", title="{UniformDistribution}", year="2016", howpublished="\url{https://reference.wolfram.com/language/ref/UniformDistribution.html}", note=[Accessed: 06-October-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_uniformdistribution, organization={Wolfram Research}, title={UniformDistribution}, year={2016}, url={https://reference.wolfram.com/language/ref/UniformDistribution.html}, note=[Accessed: 06-October-2024 ]}