Ask Your Question

adk's profile - activity

2015-01-13 20:35:03 +0200 received badge  Taxonomist
2014-06-29 06:56:49 +0200 received badge  Famous Question (source)
2014-06-23 21:21:52 +0200 received badge  Notable Question (source)
2012-11-25 19:57:14 +0200 received badge  Popular Question (source)
2011-05-12 06:24:21 +0200 marked best answer Compute the centroid of a polytope

There is no such function currently implemented. However, it would not be difficult to add. The straightforward approach would be to triangulate the polytope, find the barycenter of the simplices, and then add their individual barycenters weighted by the fraction of the total mass.

If you want to contribute a centroid method make a trac ticket and cc me, I'd be happy to help.

2011-05-12 06:24:21 +0200 received badge  Scholar (source)
2011-05-12 06:24:04 +0200 received badge  Supporter (source)
2011-04-29 04:21:06 +0200 commented answer Compute the centroid of a polytope

Thanks for the suggestion, but I'm not looking for the average of the vertices; I'm looking for the center of mass. I looked through the Polyhedra documentation and was unable to find a suitable command which is why I asked this question. Most likely no such command exists, but I thought I'd check to be sure.

2011-04-28 19:58:29 +0200 received badge  Editor (source)
2011-04-27 15:50:26 +0200 asked a question Compute the centroid of a polytope

Does SAGE have a way to compute the center of mass of a polytope? I tried using polymake's centroid method, but that returned an error because the dimension of my polytope is not equal to the ambient dimension. I've read the manual and looked at the available functions but can't seem to find a SAGE command to do this. Does it exist?

EDIT: By request here's some sample _polymake_ code that fails (I'm not sure why this would be useful unless SAGE is using polymake under the hood):

polytope > $q=permutahedron(3);

polytope > print $q->CENTROID;

polymake: WARNING: could not compute 'CENTROID' probably because of unsatisfied preconditions:

precondition : DIM, AMBIENT_DIM ( CENTROID, VOLUME : VERTICES, TRIANGULATION.FACETS )

I'm guessing the error occurs because the ambient dimension of this polytope is 4 but the actual dimension of the polytope is 3; this is the same reason polymake tells me the volume of q is 0.