Problem 44694. Monte Carlo integration: area of a polygon
Solution Stats
Problem Comments
-
1 Comment
Monte Carlo Integration improves its results as we increase the number of samples, and the test suite should probably consider this. Step 4 of the algorithm, according to the problem's description, claims the process needs to be repeated 2N or 3N times, but the test suite requires that we test it only N times.
For instance, in test #4, the Axis Aligned Bounding Box has area 4 and our N=1. Therefore, for a single random point, the resulting area will be 0 or 4. And as such, the test suite only tests for 0 and 4 as valid areas. However, suppose we repeated this process three times, as the problem's description states. In that case, it's improbable that we would get three 0s or three 4s. In 75% of cases, one or two results would be different, [0 0 4] or [4 0 4], resulting in an area of 4/3 or 8/3. Curiously, by repeating this process twice, we might reach the correct value of 2 for [0 4] and [4 0].
Solution Comments
-
1 Comment
An elegant solution.
Problem Recent Solvers5
Suggested Problems
-
Make the vector [1 2 3 4 5 6 7 8 9 10]
43952 Solvers
-
2510 Solvers
-
426 Solvers
-
Construct a string from letters and counts
138 Solvers
-
21 Solvers
More from this Author32
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!