How do you use a Monte Carlo method to approximate the area enclosed by the circle.
Asked
Active
Viewed 254 times
0
-
Did you see these items https://mathematica.stackexchange.com/questions/37074/finding-the-area-of-a-circle-using-monte-carlo-simulation and https://mathematica.stackexchange.com/questions/35683/finding-the-volume-of-a-sphere-using-the-monte-carlo-algorithm? – Moo Sep 12 '19 at 01:40
2 Answers
3
Literally the Monte Carlo Method:
reg = RegionIntersection[Disk[], Disk[{1, 1}, 2]];
NIntegrate[1, {x, y} \[Element] reg, Method -> "MonteCarlo"]
(* 2.59499 *)
Michael E2
- 235,386
- 17
- 334
- 747
2
rndPts = Table[RandomReal[{-3, 3}],{10^6},{2}];
9 Length[Select[
rndPts, #[[1]]^2 + #[[2]]^2 >
1 && (#[[1]] - 1)^2 + (#[[2]] - 1)^2 < 4 &]]/Length[rndPts]
2.51295
David G. Stork
- 41,180
- 3
- 34
- 96
