Disk Point Picking

Author

Eric W. Weisstein
March 8, 2005

This notebook downloaded from http://mathworld.wolfram.com/notebooks/ComputationalGeometry/DiskPointPicking.nb.

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

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

Additional Authors

Text by
Robert Snodden
March 30, 2004

Code

CircularDistribution[num_]:=Table[Sqrt[Random[]]{Cos[#],Sin[#]}&//@Random[Real,{0,2Pi}],{num}]

RadialDistribution[num_]:=Table[Random[]{Cos[#],Sin[#]}&//@Random[Real,{0,2Pi}],{num}]

Graphic

Show[GraphicsArray[
{
Graphics[{
{Red,PointSize[.01],Point/@#},Circle[{0,0},1]},
AspectRatio->Automatic]&/@{RadialDistribution[10000],CircularDistribution[10000]}
}]]

If random points in the unit disk are chosen by selecting their polar coordinates (r, θ) from uniform distributions r∈[0,1], θ∈[0,2π), then they will be “bunched” near the center of the disk since the differential area d A=r d r d θ depends on r.

Rather, the coordinates should be chosen as r=(Sqrt[s]), θ=θ where s∈[0,1] and θ∈[0,2π) are uniform distributions.

Average Distance from Center

pts=CircularDistribution[10^5];//Timing

Through[{Mean,Variance}[l=Norm/@pts]]

<<Graphics`Graphics`

BarChart[Length/@Split[Ceiling[100Sort[l]]],Ticks->None,BarEdges->None,BarSpacing->-.2,AxesLabel->TraditionalForm/@{d,P[d]}]

Plot[2d,{d,0,1},PlotStyle->Red]

Integrate[2d,{d,0,1}]

Integrate[2(d^(n+1)),{d,0,1},Assumptions->n≥0]

(2/π)NIntegrate[(Sqrt[(x^2)+(y^2)]),{x,-1,1},{y,0,(Sqrt[1-(x^2)])}]

(2/π)Integrate[(Sqrt[(x^2)+(y^2)]),{x,-1,1},{y,0,(Sqrt[1-(x^2)])}]