subject

In this problem, we will write a program to use a Monte Carlo simulation to approximate the area of the region of overlap of disks in the plane. Your program should take two command line arguments: the name of a file, and a long long int N representing the number of trials to conduct. The file will consist of an unknown number of lines, each with three doubles, separated by commas. The first two doubles on each line will represent the x and y coordinates respectively of a disk, and the third will represent its radius. The region of overlap is the set of points lying inside every one of the disks specified by the file. A Monte Carlo procedure to determine this area can be described very briefly as follows: (a) For N total trials, draw a point uniformly at random from a fixed large region S that contains all of the disks. (b) Determine the count of all trials for which the point randomly selected happened to lie within every one of the disks. (c) Calculate the probability that the randomly selected point happened to lie within every disk. (d) The area of the intersection of the disks will be approximately this probability multipled by the area of the region S. Report the result to the user using six decimal places of fixed precision. Some sample input files with approximate corresponding outputs are posted on Sakai. Note that your values are likely to vary from these due to the randomness involved.

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 11:30
What do character formats do for your document's message? a.set the tone b.provide organization c.provide clarity d.set how texts align with documents
Answers: 2
question
Computers and Technology, 22.06.2019 18:40
Mariah was working on a multimedia presentation that included both video and audio files. the file was huge, and she wanted to send it to her coworker in another office. she needed to reduce the size of the file so that it could be transmitted faster. the utility she used to do this was
Answers: 2
question
Computers and Technology, 22.06.2019 19:20
1)consider the following code snippet: #ifndef book_h#define book_hconst double max_cost = 1000.0; class book{public: book(); book(double new_cost); void set_cost(double new_cost); double get_cost() const; private: double cost; }; double calculate_terms(book bk); #endifwhich of the following is correct? a)the header file is correct as given.b)the definition of max_cost should be removed since header files should not contain constants.c)the definition of book should be removed since header files should not contain class definitions.d)the body of the calculate_terms function should be added to the header file.
Answers: 1
question
Computers and Technology, 23.06.2019 23:40
4. what is the reason for including the following code snippet in the header file animal.h? #ifndef animal_h #define animal_h class animal { public: animal(); animal(double new_area_hunt); void birth(); void hunt(double new_area_hunt); void death(); double get_area_hunt() const; private: double area_hunt; }; #endif
Answers: 3
You know the right answer?
In this problem, we will write a program to use a Monte Carlo simulation to approximate the area of...
Questions
question
Mathematics, 23.03.2021 01:50
question
Mathematics, 23.03.2021 01:50
question
Mathematics, 23.03.2021 01:50
question
Mathematics, 23.03.2021 01:50
question
Mathematics, 23.03.2021 01:50
question
Mathematics, 23.03.2021 01:50
Questions on the website: 13722360