Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Monte Carlo simulations are techniques that consist of choosing sample experiments at random from a large set and then making deductions on the basis of

Monte Carlo simulations are techniques that consist of choosing sample experiments at random from a large set and then making deductions on the basis of the probabilities estimated from the result of these experiments. In this problem, you are to implement a Monte Carlo method for estimating the value of . Consider the first quadrant of a unit circle centered at (0, 0). This quarter circle lies inside a unit square. A point with coordinates (x, y) is inside the quarter circle when x 2 + y 2 1. The area of the quarter circle region can be estimated by picking, at random, points (x, y) that lie in the unit square, and for each point determining whether the point lies in the circular region or not. The fraction of points that fall in the region should give an estimate of /4 (ratio of the area of the circular region and the area of the enclosing unit square). Multiplying by 4 gives an estimate of . Write a python program mcpi.py that takes a command line integer parameter n and prints an estimate of using n random points as described above. Run your program with n = 10, 100, 10000 and comment on the values you get.

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_2

Step: 3

blur-text-image_3

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

Microsoft Visual Basic 2008 Comprehensive Concepts And Techniques

Authors: Gary B. Shelly, Corinne Hoisington

1st Edition

1423927168, 978-1423927167

More Books

Students also viewed these Databases questions