Message Boards Message Boards

0
|
4679 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

Integration over polyhedral region

Posted 5 years ago

Hi, I'm trying to evaluate integrals (symbolically or numerically) over polyhedral regions, using the new Polyhedron tools in Mathematica 12. From the documentation:

Polyhedron can be used a geometric region and a graphics primitive.

However, if I actually try to do this, it doesn't seem to work:

region = RandomPolyhedron[{"ConvexHull", 14}]
NIntegrate[x + y^2, {x, y, z} \[Element] region]

>NIntegrate::ilim: Invalid integration variable or limit(s) in {x,y,z}\[Element]Polyhedron[...]

It works fine with meshes:

R = ConvexHullMesh[RandomReal[1, {50, 3}]];
NIntegrate[x + y^2, {x, y, z} \[Element] R]
> 0.494771

Is this expected behavior or a bug? Alternatively, is there a way to query the vertices/faces of a Polyhedron so I might pass that information to BoundaryMeshRegion to convert it to a Mesh?

POSTED BY: Sam M
3 Replies
region = RandomPolyhedron[{"ConvexHull", 14}]
NIntegrate[x + y^2, {x, y, z} ? RegionBoundary[region]](*Integrate also work*)
(* 1.68902 *)

With Polyhedron:

P = Polyhedron[{{0., 0., 0.6}, {-0.3, -0.5, -0.2}, {-0.3, 
0.5, -0.2}, {0.6, 0., -0.2}}, {{2, 3, 4}, {3, 2, 1}, {4, 1, 
2}, {1, 4, 3}}]; Graphics3D[P]
NIntegrate[x + y^2, {x, y, z} ? RegionBoundary[P]](*Integrate also work*)
(* 0.0752927 *)
POSTED BY: Mariusz Iwaniuk
Posted 5 years ago

Thank you for the reply, but I'm interested in more than just convex polyhedra. PolyhedronCoordinates[] is useful, but without a way to access the list of face indices for the polyhedron, I can't seem to convert a general polyhedron to a mesh.

POSTED BY: Sam M
Posted 5 years ago

Seems like it should work based on the documentation. This works

SeedRandom[1];
poly = RandomPolyhedron[{"ConvexHull", 14}];
NIntegrate[x + y^2, {x, y, z} \[Element] ConvexHullMesh@PolyhedronCoordinates@poly]
(* 0.135477 *)
POSTED BY: Rohit Namjoshi
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract