Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

6. The Monte Carlo method is an ingenious method for finding approximate solutions to problems that cannot be precisely solved (the method is named after

image text in transcribed
6. The Monte Carlo method is an ingenious method for finding approximate solutions to problems that cannot be precisely solved (the method is named after the famous casino in Monte Carlo) Here is a typical example: It is difficult to compute the number , but you can approximate it quite well with the following simulation. Simulate shooting a dart into a square surrounding a circle of radius 1. That is easy: generate random x and y coordinates between-1 and 1 If the generated point lies inside the circle, we count it as a hit. That is the case when xy s1. Because our shots are entirely random, we expect that the ratio of hits/tries is approximately equal to the ratio of the areas of the circle and the square, that is, /4. Therefore, our estimate for 54 x hits / tries. This method yields an estimate for , using nothing but simple arithmetic. To generate a random floating-point value between -1 and 1, we can use the random) function to generate a random floating-point number r in the range 0 (inclusive) to 1 (exclusive), and then calculate-1 2 * r, which range from-1 (inclusive) to 1 (exclusive). write a Python function that, given the number of tries, produces an estimate for . See how close an approximation to you get after 1,000 tries, after 10,000 tries, after 100,000 tries and after a million tries. Paste your function definition with your test results here

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

Oracle9i Database Administrator Implementation And Administration

Authors: Carol McCullough-Dieter

1st Edition

0619159006, 978-0619159009

More Books

Students also viewed these Databases questions