Ask Your Question

Revision history [back]

exec(func()) not the same as func() ?

When I am running this:

 poly=Polyhedron(vertices=[(1, 0, 0, 0), (4752/8677, 7260/8677, 0, -35/8677), (147875/208902, 41405/69634, 79625/208902, 1877/208902), (1514240/2130249, 927472/2130249, 163072/710083, 1070281/2130249), (360/869, 300/869, 600/869, 419/869), (63000/183661, 123480/183661, 73500/183661, 95461/183661), (1871100/3093289, 1568160/3093289, 1524600/3093289, 1133089/3093289), (77175/215867, 113400/215867, 119070/215867, 116642/215867), (169000/263949, 41600/87983, 13520/37707, 128749/263949)],base_ring=QQ)
print(poly.vertices())

I get the expected result. However, if I run this

exec('poly=Polyhedron(vertices=[(1, 0, 0, 0), (4752/8677, 7260/8677, 0, -35/8677), (147875/208902, 41405/69634, 79625/208902, 1877/208902), (1514240/2130249, 927472/2130249, 163072/710083, 1070281/2130249), (360/869, 300/869, 600/869, 419/869), (63000/183661, 123480/183661, 73500/183661, 95461/183661), (1871100/3093289, 1568160/3093289, 1524600/3093289, 1133089/3093289), (77175/215867, 113400/215867, 119070/215867, 116642/215867), (169000/263949, 41600/87983, 13520/37707, 128749/263949)],base_ring=QQ)')
print(poly.vertices())

I get something completely different. Why is that and how can I fix this? I have to use the exec-command, because I want to read the vertices from a file.