The constant is used in mathematics, physics, and other related fields such as engineering extensively. 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 circular dartboard of radius r inside a square of length 2r as shown in Figure 3. 2. Throw n number of darts rundomly 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 square (2r)2 You can approximate the probability by using the following formula: Tumber of darta inaide eircle pr total number of darts thrown Since this is an approximation, your answer may not be close to r. For instance, if I throw 10 darts and 8 of them lands inside the circle then T (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.

Advanced Engineering Mathematics
10th Edition
ISBN:9780470458365
Author:Erwin Kreyszig
Publisher:Erwin Kreyszig
Chapter2: Second-order Linear Odes
Section: Chapter Questions
Problem 1RQ
icon
Related questions
icon
Concept explainers
Topic Video
Question
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.
Transcribed Image 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.
Expert Solution
steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Application of Algebra
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, advanced-math and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Advanced Engineering Mathematics
Advanced Engineering Mathematics
Advanced Math
ISBN:
9780470458365
Author:
Erwin Kreyszig
Publisher:
Wiley, John & Sons, Incorporated
Numerical Methods for Engineers
Numerical Methods for Engineers
Advanced Math
ISBN:
9780073397924
Author:
Steven C. Chapra Dr., Raymond P. Canale
Publisher:
McGraw-Hill Education
Introductory Mathematics for Engineering Applicat…
Introductory Mathematics for Engineering Applicat…
Advanced Math
ISBN:
9781118141809
Author:
Nathan Klingbeil
Publisher:
WILEY
Mathematics For Machine Technology
Mathematics For Machine Technology
Advanced Math
ISBN:
9781337798310
Author:
Peterson, John.
Publisher:
Cengage Learning,
Basic Technical Mathematics
Basic Technical Mathematics
Advanced Math
ISBN:
9780134437705
Author:
Washington
Publisher:
PEARSON
Topology
Topology
Advanced Math
ISBN:
9780134689517
Author:
Munkres, James R.
Publisher:
Pearson,