Ask Your Question

Akababa's profile - activity

2021-04-20 00:56:21 +0100 received badge  Notable Question (source)
2020-04-12 21:59:10 +0100 received badge  Popular Question (source)
2017-07-07 15:40:01 +0100 answered a question frozenset error when plotting polytopes: bug?

I noticed that if you use Polyhedron(ngon.vertices_list()).plot() instead, it usually works.

2017-06-29 04:48:40 +0100 commented answer Animate rotating polytope

Thanks? Btw where can I find a list of all plot arguments?

2017-06-29 04:33:18 +0100 received badge  Supporter (source)
2017-06-28 17:58:42 +0100 received badge  Good Question (source)
2017-06-27 14:56:18 +0100 received badge  Nice Question (source)
2017-06-27 13:18:47 +0100 received badge  Student (source)
2017-06-27 10:55:06 +0100 asked a question Animate rotating polytope

Hello, I'm trying to save an animation of a rotating polytope as a gif. So far the best I have is this:

n=49
t = (2*pi/n).n()
M=matrix([[cos(t),0,sin(t)],[0,1,0],[-sin(t),0,cos(t)]])
p=polytopes.cube()
vl = [v[:3] for v in p.vertices()]
sf = [p]
for i in range(n):
    vl = [M*v for v in vl]
    sf.append(Polyhedron(vl))
s=animate(sf)
s.gif(savefile="an.gif")

which outputs this:

https://media.giphy.com/media/3o7bufpi3S8f1dnlNm/giphy.gif (image description)

media.giphy.com/media/3o7bufpi3S8f1dnlNm/giphy.gif (Sorry, I need more karma to post links)

My questions: 1. how can I get the axes to stay constant so it looks more like a rotating object? 2. Is there a faster/cleaner way to do this?

2017-06-14 22:12:49 +0100 commented question Polyhedron.volume() ZeroDivisionError

For some reason this site won't let me format the first code block

2017-06-14 02:52:55 +0100 asked a question Polyhedron.volume() ZeroDivisionError

Let us consider the following function

def vol(c):
    S = [g * c for g in G] 
    return Polyhedron(S).volume()
vol(vector([1.1,0.1,1]))

Here, G is the list of rotation matrices in SO(3) corresponding to the octahedral symmetry group. However when I try to run this code it gives a ZeroDivisionError. Can I do anything to fix it? It seems to work for all integer vectors but fails on most random RDF vectors.

Code to generate G:

G = [
matrix( ((0, 0, -1), (-1, 0, 0), (0, 1, 0)) ),
matrix( ((-1, 0, 0), (0, 0, 1), (0, 1, 0)) ),
matrix( ((0, 1, 0), (0, 0, -1), (-1, 0, 0)) ),
matrix( ((-1, 0, 0), (0, 0, -1), (0, -1, 0)) ),
matrix( ((0, 0, 1), (1, 0, 0), (0, 1, 0)) ),
matrix( ((1, 0, 0), (0, -1, 0), (0, 0, -1)) ),
matrix( ((0, 0, 1), (-1, 0, 0), (0, -1, 0)) ),
matrix( ((1, 0, 0), (0, 1, 0), (0, 0, 1)) ),
matrix( ((0, 1, 0), (0, 0, 1), (1, 0, 0)) ),
matrix( ((0, -1, 0), (0, 0, -1), (1, 0, 0)) ),
matrix( ((0, -1, 0), (0, 0, 1), (-1, 0, 0)) ),
matrix( ((0, 0, -1), (0, -1, 0), (-1, 0, 0)) ),
matrix( ((0, 1, 0), (1, 0, 0), (0, 0, -1)) ),
matrix( ((0, -1, 0), (-1, 0, 0), (0, 0, -1)) ),
matrix( ((0, 0, -1), (1, 0, 0), (0, -1, 0)) ),
matrix( ((-1, 0, 0), (0, -1, 0), (0, 0, 1)) ),
matrix( ((1, 0, 0), (0, 0, -1), (0, 1, 0)) ),
matrix( ((0, 0, 1), (0, 1, 0), (-1, 0, 0)) ),
matrix( ((0, 1, 0), (-1, 0, 0), (0, 0, 1)) ),
matrix( ((-1, 0, 0), (0, 1, 0), (0, 0, -1)) ),
matrix( ((0, -1, 0), (1, 0, 0), (0, 0, 1)) ),
matrix( ((1, 0, 0), (0, 0, 1), (0, -1, 0)) ),
matrix( ((0, 0, 1), (0, -1, 0), (1, 0, 0)) ),
matrix( ((0, 0, -1), (0, 1, 0), (1, 0, 0)) )
]