Problem 44694. Monte Carlo integration: area of a polygon
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 CommentsShow comments
Problem Recent Solvers6
Return elements unique to either input
Find third Side of a right triangle given hypotenuse and a side. No * - or other functions allowed
Apply a function array to an array of numbers
(Linear) Recurrence Equations - Generalised Fibonacci-like sequences
More from this Author32
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!