Uniform Distribution

Author

Eric W. Weisstein
November 23, 2008

This notebook downloaded from http://mathworld.wolfram.com/notebooks/Statistics/UniformDistribution.nb.

For more information, see Eric's MathWorld entry http://mathworld.wolfram.com/UniformDistribution.html.

©2008 Wolfram Research, Inc. except for portions noted otherwise

Continuous Distribution

Stats

Stats[UniformDistribution[a,b],x]//StatsForm//TraditionalForm

PDF

PDF[UniformDistribution[a,b],x]

Integrate[((Sign[-a+x]-Sign[-b+x])/(2 (-a+b))),{x,a,b},Assumptions->a<b]

Integrate[((UnitStep[x-a]-UnitStep[x-b])/(b-a)),{x,a,b},Assumptions->a<b]

CDF

CDF[UniformDistribution[a,b],x]

FullSimplify[Integrate[((Sign[-a+x]-Sign[-b+x])/(2 (-a+b))),{x,a,x},Assumptions->a<x<b]]

FullSimplify[Integrate[((UnitStep[x-a]-UnitStep[x-b])/(b-a)),{x,a,x},Assumptions->a<x<b]]

FullSimplify[Integrate[((UnitStep[x-a]-UnitStep[x-b])/(b-a)),{x,-Infinity,x}]]

FullSimplify[%,a<x<b]

Raw Moments

v5.0.1

Integrate[((UnitStep[x-a]-UnitStep[x-b])/(b-a))x^n,{x,-∞,∞}]

FullSimplify[%,a<b&&n∈Integers]

Integrate[((UnitStep[x-a]-UnitStep[x-b])/(b-a))x^n,{x,a,b},Assumptions->a<b]

Integrate[PDF[UniformDistribution[a,b],x]x^n,{x,a,b}]

v6

<<Statistics`ContinuousDistributions`

PDF[UniformDistribution[a,b],x]

Integrate[PDF[UniformDistribution[a,b],x]x^n,{x,-∞,∞}]

Integrate[PDF[UniformDistribution[a,b],x]x^n,{x,-∞,∞},Assumptions->a<b]

Integrate[PDF[UniformDistribution[a,b],x]x^n,{x,a,b}]

Integrate[PDF[UniformDistribution[a,b],x]x^n,{x,a,b},Assumptions->a<x<b]

Table

Factor[Table[(((a^(n+1))-(b^(n+1)))/((a-b)(n+1))),{n,0,4}]]

Central Moments

v5.0.1

Integrate[PDF[UniformDistribution[a,b],x](x-(a+b)/2)^n,{x,a,b}]

i=Integrate[((UnitStep[x-a]-UnitStep[x-b])/(b-a))(x-(a+b)/2)^n,{x,a,b}]

Simplify[Table[i,{n,5}],a<b]

Simplify[Table[Integrate[((UnitStep[x-a]-UnitStep[x-b])/(b-a))(x-(a+b)/2)^n,{x,a,b}],{n,5}],a<b]

FullSimplify[i,a<b&&n∈Integers]

Table[ (((-a+b))^n),{n,0,5}]

Integrate[((UnitStep[x-a]-UnitStep[x-b])/(b-a))(x-(a+b)/2)^n,{x,-∞,∞}]

FullSimplify[%,a<x<b&&n∈Integers&&n>0]

FullSimplify[Table[(((((a-b))^n) (((a+b))^(-n)) ((((-a-b))^n)+(((a+b))^n)))/((n+1)(2^(n+1)))),{n,5}]]

Expand[(((a-b))^n) (((a+b))^(-n)) ((((-a-b))^n)+(((a+b))^n))]

(((a-b))^n)+(((a+b))^n) (-1)^n(((a-b))^n) (((a+b))^(-n))

(((a-b))^n)+(b-a)^n

FullSimplify[(((a-b))^n) (((a+b))^(-n)) ((((-a-b))^n)+(((a+b))^n)),n∈Integers]

Table[Subtract@@{(((a-b))^n) (((a+b))^(-n)) ((((-a-b))^n)+(((a+b))^n)),(((a-b))^n)+(((-a+b))^n)},{n,-5,5}]//Simplify

Table

FullSimplify[Table[(((((a-b))^n)+(((b-a))^n))/((n+1)(2^(n+1)))),{n,0,5}]]

Plot

Show[GraphicsArray[{
Plot[UnitStep[x]-UnitStep[x-1],{x,-1,2},DisplayFunction->Identity,PlotStyle->{RGBColor[1,0,0]},Ticks->None,AxesLabel->TraditionalForm/@{x,P[x]}],
Plot[-(-1+x) UnitStep[-1+x]+x UnitStep[x],{x,-1,2},Ticks->None,DisplayFunction->Identity,AxesLabel->TraditionalForm/@{x,"\!\(\*
StyleBox[\"D\",\nFontSlant->\"Italic\"]\)(\!\(\*
StyleBox[\"x\",\nFontSlant->\"Italic\"]\))"},PlotStyle->{RGBColor[1,0,0]}]
}]
]

Check of Different Forms for P(x)

Show[GraphicsArray[
Plot[#,{x,-1,2},
DisplayFunction->Identity,
PlotLabel->TraditionalForm[#],
PlotStyle->Red]&/@{
(Sign[x]-Sign[x-1])/2,
UnitStep[x]-UnitStep[x-1]}
]]

Characteristic Function

FullSimplify[CharacteristicFunction[UniformDistribution[a,b],t]]

Simplify[TrigToExp[%/.{a->0,b->1}]]

2/(b-a)/t Sin[(b-a)t/2]Exp[I(a+b)t/2] /. {a->0,b->1}

Simplify[%]