With Monte Carlo, we randomly sample points within a bounded space and count how many are inside the curve
The ratio of inside dots (those under the curve) vs. total dots leads to an estimate of the integral
Monte Carlo is non-deterministic when a random number generator is used to create the sample points
Meaning the output of MC calculations may vary due to variance in the samples
What do you expect the area should be? (pi*r*r) = pi*1*1 = pi
Area = pi
Let's use MC to estimate it and see if we get that answer.
Step 1. Run the Code As-Is making note of the various commands.
Step 2. Alter the code to include 5000 points.
Step 3. Alter the code to include 50,000 points.