Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN PYTHON: Write a Python program that allows the user to enter a value for n (the total number of attempts). Your program should then

IN PYTHON:

Write a Python program that allows the user to enter a value for n (the total number of attempts). Your program should then simulate throwing n darts at the figure by randomly picking coordinates (x, y) between -1.0 and 1.0. Keep track of the darts that land within the circle, and show the resulting estimate for .

Python hint: Pythons random() function (located in the random module) behaves the same as Javas Math.random() it returns a uniformly distributed pseudorandom real number in the interval [0.0, 1.0). To call it:

import random x = random.random()

image text in transcribed

(10 pts) This problem deals with continuous (rather than discrete probability, but it's an interesting problem! It involves probabilistically estimating the value of t. Consider a circle of radius l inscribed within a square with side 2. Both shapes are centered at the origin (0, 0) Using basic geometry, the ratio of the circle's area to the square's area is T(1)222 T/4. Now, suppose that you randomly throw some darts at this figure. Out of n total (0,0) attempts, m attempts landwithin the circle. As the number of attempts becomes large, the ratio maln should approach the ratio of the circle's area to the square's area. Thus, we can write t/4 mln. Solving for TT gives us 1t 4m

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions

Question

What can a health care provider vary across different payers?

Answered: 1 week ago

Question

1 What demand is and what affects it.

Answered: 1 week ago