Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

is a Greek symbol standing for an irrational number which is used in all kinds of calculations. Its decimal representation never terminates, but it has

is a Greek symbol standing for an irrational number which is used in all kinds of calculations. Its decimal representation never terminates, but it has been calculated to 5 trillion digits! How is it calculated? there are many different methods.

The Monte Carlo method is a mathematical method to get answers to questions which are hard to solve analytically (by hand). It involves using random numbers to simulate a situation. In the case of finding , the situation imagined is throwing darts at the square in the picture below. The area of the square is 1x1 or 1 unit. The area of the circle that is inside the square is one fourth of the whole circle, whose area is units (radius = 1, so area is times 1 squared = ). So the area of the part of the circle that is in the square is one fourth . first-quadrant.png

You throw random darts at the square, by generating random numbers between 0 and 1 for the x and y coordinates.

How do you determine if a dart lands in the circle? The equation for a circle like this one is x ** 2 + y ** 2 = 1. That describes the points ON the circle. So if x ** 2 + y ** 2 is less than 1, it's inside the circle.

If the random point generated (dart) is inside the circle, count it.

After all the darts are thrown, find the ratio of the number of darts inside to the number thrown. Multiply the result by 4 because we are only doing one fourth of the circle. This is your approximation to . ( Don't divide by zero )

Calculate how close the approximation is to the math library's value for . ( 10 significant digits, 9 places to the right of the decimal )

in python please!

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

More Books

Students also viewed these Databases questions