Estimating the value of π. The following figure suggests how

Estimating the value of π. The following figure suggests how to estimate the value of π with a simulation. In the figure, a circle with area equal toπ/4 is inscribed in a square whose area is equal to 1. One hundred points have been randomly chosen from within the square. The probability that a point is inside the circle is equal to the fraction of the area of the square that is taken up by the circle, which is π/4. We can therefore estimate the value of π/4 by counting the number of points inside the circle, which is 79, and dividing by the total number of points, which is 100, to obtain the estimate π/4 ≈ 0.79. From this we conclude that π ≈ 4(0.79) = 3.16. This exercise presents a simulation experiment that is designed to estimate the value of π by generating 1000 points in the unit square.

a. Generate 1000 x coordinates X1, . . ., X1000. Use the uniform with minimum value 0 and maximum value 1.

b. Generate 1000 y coordinates Y1, . . ., Y1000, again using the uniform with minimum value 0 and maximum value 1.

c. Each point (Xi, Yi ) is inside the circle if its distance from the center (0.5, 0.5) is less than 0.5. For each pair (Xi, Yi ), determine whether its distance from the center is less than 0.5. This can be done by computing the value (Xi −0.5)+ (Yi −0.5)2, which is the squared distance, and determining whether it is less than 0.25.

d. How many of the points are inside the circle? What is your estimate of π? With only 1000 points, it is not unlikely for your estimate to be off by as much as 0.05 or more. A simulation with 10,000 or 100,000 points is much more likely to provide an estimate that is very close to the true value.

 

Leave a Comment

Your email address will not be published. Required fields are marked *

GradeEssays.com
We are GradeEssays.com, the best college essay writing service. We offer educational and research assistance to assist our customers in managing their academic work. At GradeEssays.com, we promise quality and 100% original essays written from scratch.
Contact Us

Enjoy 24/7 customer support for any queries or concerns you have.

Phone: +1 213 3772458

Email: support@gradeessays.com

© 2024 - GradeEssays.com. All rights reserved.

WE HAVE A GIFT FOR YOU!

15% OFF 🎁

Get 15% OFF on your order with us

Scroll to Top