Question: I already finish the code, but the error result in my code seems not likely become smaller when the darts become bigger, is that an

 I already finish the code, but the error result in my

I already finish the code, but the error result in my code seems not likely become smaller when the darts become bigger, is that an error?

here is my code

#include

#include

#include

#include

#include

using namespace std;

int main()

{

double x, y, z = 0;

double error;

srand(time(0));

double exactarea = 2.22144146907918;

cout

for (int i = 10; i

for (int j = 0; j

x = -1.0 + (2.0 * (rand() / (double)RAND_MAX));

y = -1.0 + (2.0 * (rand() / (double)RAND_MAX));

if ((x * x) + (2 * y * y)

z++;

}

}

double estarea = (4 * z / double(i));

if (estarea > exactarea) {

error = estarea - exactarea;

}

else {

error = exactarea - estarea;

}

cout

}

system("pause");

return 0;

}

PIC 10A Homework Due Friday, Nov 2 Problem 1: (Monte Carlo Experiments) The Monte Carlo method is used in modeling a wide-range of physical systems at the forefront of scientific research today. Let's consider the problem of estimating the area of the region 12 + 2y2 to format your output

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!