The constant is used in mathematics, physics, and other related fields such as engineering ertensively. In this exercise, you are going to compute an approximation of the constant T. Gambler Jack is...


The constant is used in mathematics, physics, and other related fields such as engineering<br>ertensively. In this exercise, you are going to compute an approximation of the constant T.<br>Gambler Jack is no mathematician. His friends laugh at him and make a bet that Jack does<br>not know the number x, not even the first three most significant digits. Jack is going to lose the<br>bet but his girlfriend, Jane, is an accountant and she is going to help. She suggested Jack the<br>following idea.<br>r.<br>2r<br>Figure 3: A circle with radius r inside a square with sides of length 2r.<br>1. Use a cireular dartboard of radius r inside a square of length 2r as shown in Figure 3.<br>2. Throw n mumber of darts randomly onto the dartboard.<br>3. Count the number m of darts that falls inside the circle.<br>4. The ratio of m over n is approximately a quarter of a circle.<br>If you are still lost, the conversation above can be distilled into the following equation for<br>computing the probability p of the dart landing inside the cirele:<br>area of circle<br>area of aquare<br>(2r)2<br>You can approximate the probability by using the following formula:<br>Tumber of darta inaide circle<br>pr<br>total number of darts thrown<br>Since this is an approximation, your answer may not be close to n. For instance, if I throw 10<br>darts and 8 of them lands inside the circle then n (8/10) x 4 = 3.2.<br>Question<br>Write the function monte_carlo_p1(n) which returns an approximation of a by throwing the<br>darts n times. Theoretically, the more darts you throw, the more accurate your n is.<br>

Extracted text: The constant is used in mathematics, physics, and other related fields such as engineering ertensively. In this exercise, you are going to compute an approximation of the constant T. Gambler Jack is no mathematician. His friends laugh at him and make a bet that Jack does not know the number x, not even the first three most significant digits. Jack is going to lose the bet but his girlfriend, Jane, is an accountant and she is going to help. She suggested Jack the following idea. r. 2r Figure 3: A circle with radius r inside a square with sides of length 2r. 1. Use a cireular dartboard of radius r inside a square of length 2r as shown in Figure 3. 2. Throw n mumber of darts randomly onto the dartboard. 3. Count the number m of darts that falls inside the circle. 4. The ratio of m over n is approximately a quarter of a circle. If you are still lost, the conversation above can be distilled into the following equation for computing the probability p of the dart landing inside the cirele: area of circle area of aquare (2r)2 You can approximate the probability by using the following formula: Tumber of darta inaide circle pr total number of darts thrown Since this is an approximation, your answer may not be close to n. For instance, if I throw 10 darts and 8 of them lands inside the circle then n (8/10) x 4 = 3.2. Question Write the function monte_carlo_p1(n) which returns an approximation of a by throwing the darts n times. Theoretically, the more darts you throw, the more accurate your n is.
Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here