Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Matlab The Monte Carlo method is used in a wide variety of fields, from finance to engineering to robots to computer science. Named after the
Matlab
The Monte Carlo method is used in a wide variety of fields, from finance to engineering to robots to computer science. Named after the famous gambling city of the same name, the method uses random samples to calculate values of functions that are just too difficult to calculate by any other means. It's used in robotics as a way to figure out where the robot is (generate a bunch of possible locations and then keep the most probable ones based on sensor readings). It's used in computer graphics rendering to calculate light diffusing through fog, cracks of doors, or caustics by generating a bunch of light paths bouncing around the scene In this problem, you'll use random sampling to do something a bit simpler - calculate the value of pi. You'll simulate throwing darts uniformly at a dart board and calculate how many lie inside the circle versus outside. The ratio of these numbers will tell you an approximation of pi. Things you will need to know: Area of a square with side length 2r: (2r)2 Area of a circle with radius r. Tr2 A circle of radius r fits nicely in a square with side length 2r The rand function in MATLAB will generate a uniformly random number between 0 and 1 . o Google "uniform random distribution" If r is 0.5, the dart board has side length 1. o ...so put the circle center at (0.5, 0.5)... To-Do: Calculate the value of pi by throwing 10,000 darts at the dartboard. Repeat these 10,000 throws 400 times and average the result. Show a picture of the dart locations and the dart board for one iteration Print out your answer. a. b. Hints: 1) The ratio of the area of the circle to the area of the square can be used to solve for pi Area of circle dArea of square b. Rearrange above equation to get pi (something) c. "A" is the ratio of the number of darts that end up in the circle versus the number that don't
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started