ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 04 Jun 2021 22:11:36 +0200multiplication of a polytopehttps://ask.sagemath.org/question/57455/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 ?Fri, 04 Jun 2021 19:04:27 +0200https://ask.sagemath.org/question/57455/multiplication-of-a-polytope/Answer by tmonteil for <p>I answering to my question <code>https://ask.sagemath.org/question/57371/how-to-transform-a-derived-set-of-inequation-in-the-good-polyhedron-format/</code> tmonteil gives me the very nice code</p>
<pre><code>D = polytopes.dodecahedron()
M = matrix([[0,1,0],[0,0,1]])
(M * D).plot()
</code></pre>
<p>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. </p>
<p>A second question is : how to translate D in the 3D space ?</p>
https://ask.sagemath.org/question/57455/multiplication-of-a-polytope/?answer=57459#post-id-57459Regarding 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?Fri, 04 Jun 2021 19:21:42 +0200https://ask.sagemath.org/question/57455/multiplication-of-a-polytope/?answer=57459#post-id-57459Comment by slelievre for <p>Regarding your first question, Sage relies on various libraries to represent and deal with polyhedras, so there are various corresponding backends, like <code>ppl</code>, <code>cdd</code>, <code>normaliz</code>, <code>polymake</code>. In the case of your docahedron, the backend is named <code>field</code>, which means that it relies on Sage own code, not external library:</p>
<pre><code>sage: D.backend()
'field'
</code></pre>
<p>Now, to see the corresponding source code, you can do:</p>
<pre><code>sage: from sage.geometry.polyhedron.backend_field import Polyhedron_field
sage: Polyhedron_field??
</code></pre>
<p>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. </p>
<p>Regarding your second question, D is already a subset of some 3d space : </p>
<pre><code>sage: D.ambient_space()
Vector space of dimension 3 over Number Field in sqrt5 with defining polynomial x^2 - 5 with sqrt5 = 2.236067977499790?
</code></pre>
https://ask.sagemath.org/question/57455/multiplication-of-a-polytope/?comment=57463#post-id-57463Maybe 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.Fri, 04 Jun 2021 22:11:36 +0200https://ask.sagemath.org/question/57455/multiplication-of-a-polytope/?comment=57463#post-id-57463