The area of ImplicitRegion
gives two very different answers when I introduce a small amount of error.
poly[x_, y_] = 4.3 x + 2.1 y;
triangle = Triangle[{{-1., 0.}, {0., 1.}, {1., 0.}}];
Show[Graphics[{Transparent, EdgeForm[{Thick, Black}], triangle}],
ContourPlot[poly[x, y], {x, y} \[Element] triangle, Contours -> {0}]]
reg = ImplicitRegion[
poly[x, y] < 0 && {x, y} \[Element] triangle, {x, y}];
area = RegionMeasure[reg]
Show[Graphics[{Transparent, EdgeForm[{Thick, Black}], triangle}],
RegionPlot[reg]]
In the case above the area is about 0.335937. When I introduce a small amount of error into the polynomial poly[x_, y_] = x (4.3 + 4.440892098500626*^-16 y) + 2.1 y
, RegionMeasure
returns an area of 0.5, which is clearly wrong because the area of triangle
is equal to 1 and from the plots you can see that the shaded region is less than half of the triangle. How can I get Mathematica to give me the correct area in the second case?