Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I have here an entry level statistics question from second year university. Plea

ID: 3135110 • Letter: I

Question

I have here an entry level statistics question from second year university. Please show me the correct solution with clear procedure, thank you!

Question 2: MC integration to find pi 1.0 0.8 0.6 0.4 0.2 0.0 0.0 0.2 0.4 0.6 0.8 We can use the Monte Carlo method to estimate the value of pi. Consider a circle with unit radius centred at the origin of an xy coordinate system, as pictured above. You can generate data points that are uniformly distributed in the quadrant of positive X and positive y by generating pairs of uniform random numbers between 0 and 1 as shown by the points in the figure). The fraction of those points that have ac2 y2 1 will lie in the circle, and the others will be outside the unit circle. You can use the fraction, f of the number of points that fall inside of the unit circle over the total number of points to estimate a value of pi. That fraction will be equal to the ratio of the area of the quarter circle to the unit square a) Generate 100,000 points uniformly and randomly distributed in the quadrant $0

Explanation / Answer

I have done the analysis in R.

Its quite simple,You can put a random function and give a range from 0 to 1 to print 2 numbers.

First number is your x and the second is your y

Now run this for 200000 times so as to get your 100000 points

Now for each point. if (0,0) and (x,y) lie on the same side,then the point is inside the curve.

Hence (0^2+0^2-1)*(x^2+y^2-1)>0

if this happens for a point,count=count+1

so this repeats

Now this final count/10000 will give the fraction lying inside the curve.

The first time I have done, I got=0.785412,0.785612,0.785102------------

So now we run this loop for 10000 times.and we add the counts every time,And finally we average the counts

I have done this for 2 times and multiplied by 4 to get the value of pi---------->3.141593,3.141593

They turned out to be equal.This maybe due to the rounding up of the numbers.