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.Tue, 11 May 2021 21:07:02 +0200Subfaces of a face in Polyhedra package?https://ask.sagemath.org/question/57069/subfaces-of-a-face-in-polyhedra-package/I'm using polyhedra package and I need the operation that, for a given face, provides the list of all its subfaces (as faces in the bigger polyhedron). If I'm doing something like face.as_polyhedron().faces(n), the faces stop being recognised as belonging to the bigger polyhedron. What is the correct way to do that?Tue, 11 May 2021 15:58:50 +0200https://ask.sagemath.org/question/57069/subfaces-of-a-face-in-polyhedra-package/Answer by tmonteil for <p>I'm using polyhedra package and I need the operation that, for a given face, provides the list of all its subfaces (as faces in the bigger polyhedron). If I'm doing something like face.as_polyhedron().faces(n), the faces stop being recognised as belonging to the bigger polyhedron. What is the correct way to do that?</p>
https://ask.sagemath.org/question/57069/subfaces-of-a-face-in-polyhedra-package/?answer=57072#post-id-57072This is probably a hack since it touches a hidden attribute, but you can try the following:
Setting:
sage: A = polytopes.associahedron(['A',3])
sage: f = list(A.face_generator())[2]
sage: f
A 2-dimensional face of a Polyhedron in QQ^3 defined as the convex hull of 5 vertices
sage: G = f.as_polyhedron().faces(1) ; G
(A 1-dimensional face of a Polyhedron in QQ^3 defined as the convex hull of 2 vertices,
A 1-dimensional face of a Polyhedron in QQ^3 defined as the convex hull of 2 vertices,
A 1-dimensional face of a Polyhedron in QQ^3 defined as the convex hull of 2 vertices,
A 1-dimensional face of a Polyhedron in QQ^3 defined as the convex hull of 2 vertices,
A 1-dimensional face of a Polyhedron in QQ^3 defined as the convex hull of 2 vertices)
sage: g = G[0]
sage: g
A 1-dimensional face of a Polyhedron in QQ^3 defined as the convex hull of 2 vertices
Your problem is that :
sage: g.polyhedron()
A 2-dimensional polyhedron in QQ^3 defined as the convex hull of 5 vertices
sage: g.polyhedron() == f.as_polyhedron()
True
sage: g.polyhedron() == A
False
What you can try:
sage: g._polyhedron = A
Then you have:
sage: g.polyhedron()
Generalized associahedron of type ['A', 3] with 14 vertices
sage: g.polyhedron() == A
True
Then, you should play with it to see whether there are side effects. I did not check the source code for that, use at you own risk.Tue, 11 May 2021 16:38:22 +0200https://ask.sagemath.org/question/57069/subfaces-of-a-face-in-polyhedra-package/?answer=57072#post-id-57072Comment by Polydarya for <p>This is probably a hack since it touches a hidden attribute, but you can try the following:</p>
<p>Setting:</p>
<pre><code>sage: A = polytopes.associahedron(['A',3])
sage: f = list(A.face_generator())[2]
sage: f
A 2-dimensional face of a Polyhedron in QQ^3 defined as the convex hull of 5 vertices
sage: G = f.as_polyhedron().faces(1) ; G
(A 1-dimensional face of a Polyhedron in QQ^3 defined as the convex hull of 2 vertices,
A 1-dimensional face of a Polyhedron in QQ^3 defined as the convex hull of 2 vertices,
A 1-dimensional face of a Polyhedron in QQ^3 defined as the convex hull of 2 vertices,
A 1-dimensional face of a Polyhedron in QQ^3 defined as the convex hull of 2 vertices,
A 1-dimensional face of a Polyhedron in QQ^3 defined as the convex hull of 2 vertices)
sage: g = G[0]
sage: g
A 1-dimensional face of a Polyhedron in QQ^3 defined as the convex hull of 2 vertices
</code></pre>
<p>Your problem is that :</p>
<pre><code>sage: g.polyhedron()
A 2-dimensional polyhedron in QQ^3 defined as the convex hull of 5 vertices
sage: g.polyhedron() == f.as_polyhedron()
True
sage: g.polyhedron() == A
False
</code></pre>
<p>What you can try:</p>
<pre><code>sage: g._polyhedron = A
</code></pre>
<p>Then you have: </p>
<pre><code>sage: g.polyhedron()
Generalized associahedron of type ['A', 3] with 14 vertices
sage: g.polyhedron() == A
True
</code></pre>
<p>Then, you should play with it to see whether there are side effects. I did not check the source code for that, use at you own risk.</p>
https://ask.sagemath.org/question/57069/subfaces-of-a-face-in-polyhedra-package/?comment=57081#post-id-57081Thank you very much!Tue, 11 May 2021 21:07:02 +0200https://ask.sagemath.org/question/57069/subfaces-of-a-face-in-polyhedra-package/?comment=57081#post-id-57081