Select Page

This is a rectangle inside a circle, we have a rectangle and a circle as the known shapes.
Area of the circle is πr2 …………………(i)
Area of a rectangle is L X W …………… (ii)
Probability of the ball going through the rectangle (goal) is
Area of rectangleArea of a circle=L X Wπr2 ………………………………………. (iii)
But L = 4 and W = 2; so, from (ii) we get 8.
From the equation (iii) above, we have 8πr2 ……………………………(iv)
Consider the triangle inside the rectangle where r is the hypotenuse, 2 is the base and 1 is the height
By Pythagoras theorem we have r2=12+22=5
That means from (iv) we have 85π …………………..(v)
We shall consider the following points:
Let N be the number of trial or attempts to have the ball go into the region of goal (where it does not matter where the ball goes)
If the ball in the rectangle, we shall assign 1, otherwise we shall assign 0
xi=1 or xo=0
For the N times; P=1Nxi………………. (vi)
So, P found (vi) is 85π approx. 0.509
1Nxi= 85π ……………………….. (vii)
Making pi the subject we have π=8N5xi
Therefore, this is the numerical value for the fraction of balls entering the goal to the total number of balls in the circular area. The numerical value is therefore 0.509
If we consider a cartesian plane where the radius r2=(x2+y2)
Where r2 is 5. So, we know that any point(x,y) in that circle can be expressed as
(x2+y2)≤r2
The code is written T2 (below):
%************************* Parameter Notation ******************************
%P: Sum of the possibilities of shooting successfully
%P0: Possibility of shooting in the goal successfully in each simulation
%R: Number of runs of the simulation
%N: Number of shots in each run of the simulation
%S: Number of shots that are shot in successfully in each simulation
%r: The radius coordinate of each point
%a: The angle coordinate of each point
%x: The horizontal coordinate of each point
%y: The vertical coordinate of each point
function [Result]=PartOneUniform(N,R)
P=0; %Initialize the P
rect=[-2,-2,2,2,-2;-1,1,1,-1,-1]; %Draw the rectangle and cirle
plot(rect(1,:),rect(2,:),’k’)
hold on
ezplot(‘xˆ2+yˆ2=5’)
hold on
for R=1:R
S=0; %Initialize the S for each estimation
for N=1:N
r=sqrt(5)*sqrt(rand()); %Uniform random generators of the