Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. (9 pts) In class we used Monte Carlo simulation to estimate the area of a cir

ID: 3871053 • Letter: 1

Question

1. (9 pts) In class we used Monte Carlo simulation to estimate the area of a circle. You can use the Monte Carlo method to estimate the area of all kinds of shapes! In this problem you will estimate the area of the intersection of two overlapping circles. That is, you will estimate the area of the shaded region below: Specifically, imagine that these are two unit circles (circles with radius 1). Their centers lie on the x-axis, symmetrically placed on either side of the x-axis. Write a program called mcintersection.py that uses the Monte Carlo method to estimate the area of this shape (and prints the result). Your program should take two command-line parameters: distance and numDarts. The distance parameter specifies how far away the circles are from the origin on the x-axis. So if distance is 0, then both circles are centered on the origin, and completely overlap. If distance is 0.5 then one circle is centered at (-0.5, 0) and the other at (0.5, 0). If distance is 1 or greater, then the circles do not overlap at all! In that last case, your program can simply output 0. The numDarts parameter should specify the number

Explanation / Answer

Try this if it doesn't work comment I will change the code: