Question

What estimate of pi would our randomized algorithm compute if our source of random numbers gives...

What estimate of pi would our randomized algorithm compute if our source of random numbers gives the following 10 pairs of points (x,y):
-0.8322,-0.4899
-0.5224,0.5117
0.7583,0.8756
0.7782,-0.8260
0.2597,0.6354
-0.0072,-0.6112
-0.5218,-0.3444
-0.9582,0.9481
-0.0192,-0.2660
0.9353,-0.2829

Select an answer and submit. For keyboard navigation, use the up/down arrow keys to select an answer.

a

2.2

b

2.4

c

2.6

d

2.8

e

3.0

f

3.2

g

3.4

h

3.6

i

3.8

j

4.0

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

d) 2.8

We can estimating the value of Pi using Monte Carlo ,methods. The idea is to simulate random (x, y) points in a 2-D plane with domain as a square of side 1 unit. Imagine a circle inside the same domain with same diameter and inscribed into the square. We then calculate the ratio of number points that lied inside the circle and total number of generated points.

We know that area of the square is 1 unit sq while that of circle is \pi \ast (\frac{1}{2})^{2} = \frac{\pi}{4} .

Now for a very large number of generated points,

area of circle / area of square = points generated inside circle / total points inside square

therefore, 7 = 4 * (points generated inside circle / total points inside square)

Here I have written simple python program to calculate estimate of pi from the given set of random points.

estimate of pi.py

points = [ [-0.8322,-0.4899], [-0.5224,0.5117], [0.7583,0.8756], [0.7782,-0.8260], [0.2597,0.6354], [-0.0072,-0.6112], [-0.5218,-0.3444], [-0.9582,0.9481], [-0.0192,-0.2660], [0.9353,-0.2829]]

circle_points = 0
square_points = 0

for p in points:
    # Distance between (x, y) from the origin 
    origin_dist= p[0]**2 + p[1]**2
    # Checking if (x, y) lies inside the circle
    if (origin_dist<= 1): 
        circle_points+= 1
  
    square_points+= 1

# Estimating value of pi, 
# pi= 4*(no. of points inside the circle)/ (no. of points inside the square) 
print(4* circle_points/square_points)

Output:

Image of code:

1 points = [ [-0.8322,-0.4899], [-0.5224,0.5117], [0.7583,0.8756], [0.7782,-0.8260], [0.2597,0.6354], [-0.0072,-0.6112], [-6.

Hope you like it.


If you have any doubts ask me in comment section.
If you like my work, please give me a like and feedback. That helps me a lot. Thank you.
All the best.

Add a comment
Know the answer?
Add Answer to:
What estimate of pi would our randomized algorithm compute if our source of random numbers gives...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • please show answers clearly You may need to use the appropriate technology to answer this question....

    please show answers clearly You may need to use the appropriate technology to answer this question. Do students with higher college grade point averages (GPA) earn more than those graduates with lower GPAS?? Consider the following hypothetical college GPA and salary data (10 years after graduation). GPA Salary (8) 2.22 72,000 2.27 48.000 2.57 72,000 2.59 62,000 2.77 86,000 2.85 96,000 3.12 133,000 3.35 130,000 3.66 157,000 3.68 162,000 (a) Develop a scatter diagram for these data with college GPA...

  • • 1. What are the quarterly growth rates (Percentage Change From Preceding Period in Real Gross...

    • 1. What are the quarterly growth rates (Percentage Change From Preceding Period in Real Gross Domestic Product) for the U.S. economy for the last six quarters? Report those numbers in your submission 2. What is the average of those 6 quarters? . 3. Is the average of those growth rates above or below the long-run U.S. annual growth rate of 3.5 percent? Bureau of Economke Analysis Table 1.1.1. Percent Change From Preceding Period in Real Gross Domestic Product Percent...

  • Both the above is for one question. please answer the following according to the above. 1....

    Both the above is for one question. please answer the following according to the above. 1. Assign signals of 13C and 1H spectra as well as find the structural unit and functional group. 2. Give the structure sample answer - as follows 1H NMR: p-substituted Ar at 7.27-7.97 ppm, benzylic CH3 group at 2.42 ppm, COOH proton at 12.9 ppm 13C NMR: carbonyl C at 167.8 ppm (ester or acid), benzylic CH3 at 21.40 ppm, 4 remaining signals are Ar...

  • Please answer the NMR tables for wintergreen and Pear, can you please make it as neat...

    Please answer the NMR tables for wintergreen and Pear, can you please make it as neat as possible thanks! WINTERGREEN Pear The procedure below is written as if you were conducting this experiment in the lab. You will nee to read through it carefully to complete the lab report and answer the questions appropriately For NMR analyses, complete the spectral assignments as shown in the example below. Example of a 'H-NMR analysis table: HoHo Ha Iodomethane Há На Chemical Shift...

  • Can you please show the structure of the ester in the first chart and fill out...

    Can you please show the structure of the ester in the first chart and fill out an NMR analysis table for the synthesis of orange based on the NMR below? Could you also briefly explain your answer? 14. Fill out the table below. Complete the NMR analysis (prepare a table similar to the one given on page 4). The NMR spectrum of the ester is posted on Canvas (Modules section, “Spectral Files for Labs" folder). 3. Orange Acid: Acetic acid...

  • 9. value: 8.00 points PA 13-6 To ensure a full line of outdoor clothing and accessories,...

    9. value: 8.00 points PA 13-6 To ensure a full line of outdoor clothing and accessories, the. Use Table 13.4 To ensure a full line of outdoor clothing and accessories, the marketing department at Teddy Bower insists that they also sell waterproof hunting boots. Unfortunately, Teddy Bower does not have expertise in manufacturing those kinds of boots. Hence, Teddy Bower contacted several Taiwanese suppliers to request quotes. Due to competition, Teddy Bower knows that it cannot sell these boots for...

  • Solve A,B,C and please show work!! PA 13-4 Fashionables is a franchisee of The Unlimited, the......

    Solve A,B,C and please show work!! PA 13-4 Fashionables is a franchisee of The Unlimited, the... Use Table 13.4 Fashionables is a franchisee of The Unlimited, the well-known retailer of fashionable clothing. Prior to the winter season, The Unlimited offers Fashionables the choice of five different colors of a particular sweater design. The sweaters are knit overseas by hand, and because of the lead times involved, Fashionables will need to order its assortment in advance of the selling season. As...

  • please show work!! Additional Algo 14-3 Standard Deviation of Demand Over Multiple Periods Each period, demand...

    please show work!! Additional Algo 14-3 Standard Deviation of Demand Over Multiple Periods Each period, demand for apples is normally distributed with a mean of 290 and standard deviation of 70. Round your answer to two decimal places. What is the standard deviation of demand over 2 periods? Additional Algo 14-1 Inventory Position For a particular item, a firm has established an order-up-to level of 235 units. Currently, there are 65 units in stock, O backorders and 75 units scheduled...

  • please show work!! Additional Algo 14-3 Standard Deviation of Demand Over Multiple Periods Each period, demand...

    please show work!! Additional Algo 14-3 Standard Deviation of Demand Over Multiple Periods Each period, demand for apples is normally distributed with a mean of 290 and standard deviation of 70 Round your answer to two decimal places. What is the standard deviation of demand over 2 periods? PA 14-5 A Cold Inc is a frozen food distributor with... Use Table 141 ACold Inc is a frozen food distributor with 10 warehouses across the country. Ivan Tory, one of the...

  • Please help me solve this question using the table listed underneath the question. In the book...

    Please help me solve this question using the table listed underneath the question. In the book Advanced Managerial Accounting, Robert P. Magee discusses monitoring cost variances. A cost variance is the difference between a budgeted cost and an actual cost. Magee describes the following situation: Michael Bitner has responsibility for control of two manufacturing processes. Every week he receives a cost variance report for each of the two processes, broken down by labor costs, materials costs, and so on. One...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT