Bug introduced in 10.0.0 and fixed in 10.0.2
Given a MeshRegion:
region = DelaunayMesh[RandomReal[1, {50, 3}]]

We can numerically Integrate over it easily:
NIntegrate[x^2 y^2 z^2, {x, y, z} ∈ region]
0.0169908561
We can also Integrate over its boundary:
NIntegrate[x^2 y^2 z^2, {x, y, z} ∈ RegionBoundary@region]
0.151404597
if you replace DelaunayMesh with ConvexHullMesh, which yields a BoundaryMeshRegion, the same process works fine. This does not come as a surprise as the documentation for NIntegrate suggests that integrating over regions in this way is possible.
Now we turn our attention to NArgMin. We can mimic the built-in RegionNearest as follows:
dist[x_?VectorQ, y_?VectorQ] /; Length[x] == Length[y] := Sqrt @ Total[(x - y)^2]
regN[region_, point_] := NArgMin[{dist[point, x], x ∈ region}, x]
We can use it as follows:
regN[Disk[], {2, 3}]
{0.55470039, 0.832050166}
regN[Sphere[], {2, 3, 4}]
{0.371392166, 0.557086686, 0.742780105}
Note that Disk[] and Sphere[] are Regions. Let's try our MeshRegion from above:
regN[region, {2, 3, 4}]

So, it looks like while NIntegrate works fine with MeshRegion and BoundaryMeshRegion objects, other functions (NArgMin, NArgMax, NMinValue, NMaxValue, NMinimize, NMaximize etc.) that claim to work over regions fail for both. Is this an omission in documentation or implementation, or am I totally missing something here?
Answer
This has been confirmed by Wolfram Technology Group as a bug.
Comments
Post a Comment