Ask Your Question
0

ring pb with Polyhedron

asked 2024-03-14 10:42:46 +0200

ortollj gravatar image

Hi

why is an error generated if I comment the line:

#lNew=[[0, 0, 0], [0, -1, 0], [1, -1, 0], [0, -1, 1]]

in the code below:

var('t_x',latex_name=r"\\teta_{x}")

Adic={0: [0, 0, 0], 1: [1, 0, 0], 2: [1, 1, 0], 3: [0, 1, 0] , 
          4: [0, 0, 1], 5: [1, 0, 1], 6: [1, 1, 1], 7: [0, 1, 1]}

tetraHedron=[0, 4, 5, 7]
tetraHedronDic={}
for vertice in tetraHedron :
    tetraHedronDic[vertice]=Adic.get(vertice)

angleRot=pi/2
rotX=matrix(SR,[[1,0,0],[0,cos(t_x),-sin(t_x)],[0,sin(t_x),cos(t_x)]])
newDic={}
for k in tetraHedronDic.keys() :
    newDic[k]=list((rotX.subs(t_x=angleRot)*vector(tetraHedronDic.get(k))))

pOld=Polyhedron([tetraHedronDic.get(k) for k in tetraHedronDic.keys() ])
print('pOld vertices: ',pOld.integral_points())

lNew=[newDic.get(k) for k in newDic.keys() ]
print('lNew : ',lNew)
#lNew=[[0, 0, 0], [0, -1, 0], [1, -1, 0], [0, -1, 1]]
print('lNew : ',lNew)
pNew=Polyhedron(lNew)
print('pNew vertices : ',pNew.integral_points())
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2024-03-14 11:32:40 +0200

Max Alekseyev gravatar image

Elements of lists in newDic are not numbers but symbolic expressions (elements of SR), while symbolic ring is not supported by Polyhedron. An easy fix is to explicitly specify what base ring we actually want for polyhedron here - e.g.:

pNew = Polyhedron(lNew, base_ring=QQ)
edit flag offensive delete link more

Comments

Thank you @Max Alekseyev

ortollj gravatar imageortollj ( 2024-03-14 12:50:00 +0200 )edit

Btw, instead of [tetraHedronDic.get(k) for k in tetraHedronDic.keys() ] you can use simply tetraHedronDic.values(). Similarly, instead of [newDic.get(k) for k in newDic.keys()] you can use newDic.values().

Max Alekseyev gravatar imageMax Alekseyev ( 2024-03-14 13:18:59 +0200 )edit

yes, it’s simpler!

ortollj gravatar imageortollj ( 2024-03-14 19:23:48 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2024-03-14 10:42:46 +0200

Seen: 124 times

Last updated: Mar 14