Draw Random point Rectangle and Circle.

1.2k Views Asked by At

Plot $15$ points at random

(a) inside a rectangle $3$ inches $\times$ $4$ inches.

(b) inside a circle of $4$ inches.

I think need to use Random Number table. It is a practical problem in graduate level under University of calcutta. I am unable to solve the problem. Please help.

1

There are 1 best solutions below

0
On BEST ANSWER

Notice that the probability measure for the rectangle factors: $$ \mu\left(\mathrm{d}x, \mathrm{d}y\right) = \left( \frac{1}{3} \mathrm{d} x \right) \left(\frac{1}{4} \mathrm{d}y \right) $$ therefore uniform samples for a) can be generated as $(X,Y)$, where $X$ and $Y$ are independent uniform random variables from $(0,3)$ and $(0,4)$ respectively.

For the second question, notice that the measure factors in the radial coordinates becoming $$ \left(\frac{2}{R^2} r \, \mathrm{d} r \right) \frac{1}{2 \pi} \mathrm{d} \varphi = \left(\frac{1}{R^2} \mathrm{d} (r^2) \right) \frac{1}{2 \pi} \mathrm{d} \varphi $$ meaning that $r^2$ is uniformly distributed in $[0,R^2)$ and $\varphi$ is uniformly distributed in $[0,2\pi)$. Thus having generates appropriate uniform random variables $\mathcal{R}$ and $\Phi$ Cartesian coordinates are $( \sqrt{\mathcal{R}} \cos(\Phi), \sqrt{\mathcal{R}} \sin(\Phi) )$.

Here is example in Mathematica:enter image description here