# multiplication of a polytope

I answering to my question https://ask.sagemath.org/question/57371/how-to-transform-a-derived-set-of-inequation-in-the-good-polyhedron-format/ tmonteil gives me the very nice code

D = polytopes.dodecahedron()
M = matrix([[0,1,0],[0,0,1]])
(M * D).plot()


which do so simply what I was expecting. But as I am curious, I would like to know what is the internal representation of the polyhedra wich permit such product. Hope this is not a too stupid question with a self evident answer.

A second question is : how to translate D in the 3D space ?

edit retag close merge delete

Sort by ยป oldest newest most voted

Regarding your first question, Sage relies on various libraries to represent and deal with polyhedras, so there are various corresponding backends, like ppl, cdd, normaliz, polymake. In the case of your docahedron, the backend is named field, which means that it relies on Sage own code, not external library:

sage: D.backend()
'field'


Now, to see the corresponding source code, you can do:

sage: from sage.geometry.polyhedron.backend_field import Polyhedron_field
sage: Polyhedron_field??


As you can see, the internal representation of your polyhedron is both the V-reprentation and the H-representation, simultaneously. In both cases, it is pretty easy so see how a matrix acts on them.

Regarding your second question, D is already a subset of some 3d space :

sage: D.ambient_space()
Vector space of dimension 3 over Number Field in sqrt5 with defining polynomial x^2 - 5 with sqrt5 = 2.236067977499790?

more

Maybe the second question was really: how to apply a translation to D, ie translate it by some vector.

Indeed, M * D takes care of applying a linear map, but for affine maps one also needs translations.

( 2021-06-04 22:11:36 +0100 )edit