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.Mon, 17 Dec 2018 19:10:30 +0100Global Dependency in Polyhedron Volumehttps://ask.sagemath.org/question/44695/global-dependency-in-polyhedron-volume/ Hi all,
I am new to sage and want to use it in one of my python scripts to calculate the volume of higher dimensional polyhedrons. When executing my script I get a "ZeroDivisionError" for some of the polyhedrons. However when run in an individual script they work perfectly fine as long as there is no other calculation beforehand.
Here is an example, the file is called DebugSageVolume.py and I execute it with "sage -python DebugSageVolume.py" under Ubuntu 18.04, SageMath version 8.1
#!/usr/lib/python2.7/dist-packages/sage -python
from sage.all import *
# this works fine
matrix1 = matrix(RR, [[0, 1, 0, 0, 0], [1, -1, 0, 0, 0],
[0, 0, 1, 0, 0], [1, 0, -1, 0, 0],
[0, 0, 0, 1, 0], [1, 0, 0, -1, 0],
[0, 0, 0, 0, 1], [1, 0, 0, 0, -1],
[0.5, -0.5, -0.5, -0.5, -0.5], [-0.5, 0.5, 0.5, 0.5, 0.5]])
poly1 = Polyhedron(ieqs=matrix1)
volume1 = poly1.volume(measure="induced")
print(volume1)
#this results in an error when executed after the above. But when commenting the above this works fine
matrix2 = matrix(RR, [[0, 1, 0, 0, 0], [1, -1, 0, 0, 0],
[0, 0, 1, 0, 0], [1, 0, -1, 0, 0],
[0, 0, 0, 1, 0], [1, 0, 0, -1, 0],
[0, 0, 0, 0, 1], [1, 0, 0, 0, -1],
[0.75, -0.5, -0.5, -0.5, -0.5], [-0.75, 0.5, 0.5, 0.5, 0.5]])
poly2 = Polyhedron(ieqs=matrix2)
volume2 = poly2.volume(measure="induced")
print(volume2)
Any help would be greatly appreciated, thank you.
MichaelMichaelRMon, 17 Dec 2018 19:10:30 +0100https://ask.sagemath.org/question/44695/