Circle Line Picking

Author

Eric W. Weisstein
April 1, 2004

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

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

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

Distance

Simplify[Sqrt[#.#&[{1,0}-{Cos[θ],Sin[θ]}]]]

Monte Carlo

Mean[Norm/@(Subtract@@@Table[Through[{Cos,Sin}[2π Random[]]],{10^6},{2}])]//Timing

Mean[Sqrt[2(1-Cos[#])]&/@Table[2π Random[],{10^7}]]//Timing

4./π

Mean[1/Sqrt[2(1-Cos[#])]&/@Table[2π Random[],{10^6}]]//Timing

Analytic Distribution

{NIntegrate[Sqrt[(Cos[θ1]-Cos[θ2])^2+(Sin[θ1]-Sin[θ2])^2],{θ1,0,2π},{θ2,0,2π}]/(2π)^2,4./Pi}

Mean

Integrate[Sqrt[(1-Cos[θ])^2+Sin[θ]^2],{θ,0,2π}]/(2π)

2/π Integrate[Sin[θ/2],{θ,0,π}]

PDF

2Sin[#/2]&/@{0,Pi/2,Pi}

(1/π)FullSimplify[D[2ArcSin[l/2],l]]

FullSimplify[(1/(a π))(2/(Sqrt[4-(l^2)]))/.l->s/a,a>0]

CDF

Integrate[(2/(π (Sqrt[4 (a^2)-(s^2)]))),{s,0,s},Assumptions->0<s<2a]

%/.s->2a

Moments

Integrate[((2l^n)/(π(Sqrt[4-(l^2)]))),{l,0,2},Assumptions->n>-1]

Plot

<<Graphics`Colors`

Plot[(2/(π(Sqrt[4-(l^2)]))),{l,0,2},AxesLabel->TraditionalForm/@{l,P[l]},PlotStyle->Red]

Raw Moments

m=Table[(((2^n) Gamma[((1+n)/2)])/((Sqrt[π]) Gamma[1+(n/2)])),{n,0,35}]

eo=Transpose[Partition[m,2]]

Through[{Numerator,Denominator}[eo[[2]]Pi]]

Numerator[eo[[2]]]/4

Central Moments

μ=FullSimplify[Table[Integrate[((2(l-(Overscript[μ, ′])[[1]])^n)/(π(Sqrt[4-(l^2)]))),{l,0,2}],{n,4}]]

Variance

(Overscript[μ, ′])[[2]]-(Overscript[μ, ′])[[1]]^2

Skewness

FullSimplify[μ[[3]]/μ[[2]]^(3/2)]

Kurtosis

FullSimplify[μ[[4]]/μ[[2]]^2-3]

Bertrand's Problem

Solve[2Sin[θ/2]==1,θ]

Plot

RandomLines[n_]:=Table[{Hue[i/n],
Line[Table[{Cos[#],Sin[#]}&@Random[Real,{0,2Pi}],{2}]]},{i,n}]

l=RandomLines[50];
movie=Table[Graphics[
{Circle[{0,0},1],Thickness[.015],Take[l,n]},
AspectRatio->Automatic],{n,0,Length[l]}];

Export[gifs<>"cirlinpk.gif",Show[#,PlotRange->Table[{-1,1},{2}]]&/@movie]//Timing

Show[Graphics[{Circle[{0,0},1],Thickness[.015],l},AspectRatio->Automatic]]