Generate Points on Circle with Radius (r = 1)

214 Views Asked by At

How do I plot points in the region of a circle with radius 1, given a uniform bivariate distribution (X,Y)?

Conditional PDF of y given x is provided as: (1) / (2 * sqrt(1 - x^2))

Any help is greatly appreciated. (I am coding in Maple).

Thanks!

1

There are 1 best solutions below

1
On

I'm addressing the $\textit{first question}$: 'How do I plot points in this region ?'.

Generate a pair of 'random numbers' $\xi_{r}$ and $\xi_{t}$ which are uniformly distributed in $\left[0,1\right)$. A point$\left(x,y\right)$ in the unit disk is given by: $$ x = \sqrt{\xi_{r}}\cos\left(2\pi\xi_{t}\right)\,,\qquad y = \sqrt{\xi_{r}}\sin\left(2\pi\xi_{t}\right) $$


The following $\texttt{Mathematica}$ code makes the job with $10000$ points:

Clear[n,r,randDisk1,t];

randDisk1[] :=
Module[{r, t},
r = Sqrt[RandomReal[]];
t = 2 Pi RandomReal[];
{r Cos[t], r Sin[t]}
]

ListPlot[Table[randDisk1[], {n, 1, 10000}], 
PlotStyle -> {Red, PointSize[0.002]}, Axes -> False,AspectRatio -> 1]


enter image description here