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.Thu, 22 Sep 2022 23:02:13 +0200RuntimeError: LattE integrale program failed (exit code -6)https://ask.sagemath.org/question/64141/runtimeerror-latte-integrale-program-failed-exit-code-6/The following simple code results in a RuntimeError quoted below.
from sage.interfaces.latte import integrate
P = Polyhedron(ieqs=[[0, 1, 0, 0], [1, -1, 0, 0], [0, 0, 1, 0], [0, 1, -1, 0], [0, 0, 0, 1], [0, 1, 0, -1], [1, -1, -1, -1], [-1, 2, 1, 1]])
print( integrate( P.cdd_Vrepresentation(), cdd=True ) )
The error is
RuntimeError: LattE integrale program failed (exit code -6):
This is LattE integrale 1.7.6
Available from http://www.math.ucdavis.edu/~latte/
Invocation: /home/sc_serv/sage/local/bin/integrate --valuation=volume --triangulate --redundancy-check=none --cdd /dev/stdin
Warning: Not performing check for empty polytope, because it is unimplemented for the CDD-style input format.
size = 8 x 4
Number Type = rational
integrate: latte_gmp.cpp:76: NTL::ZZ convert_mpq_to_ZZ(__mpq_struct*): Assertion `elt.get_den() == 1' failed.
It can be also observed [at Sagecell](https://sagecell.sagemath.org/?z=eJxNjsEKgzAQRO-C_7DHBNIQe_cfPJReREowqw2osZvtoX_fxFLiYZeZN8syE4UVop1R-42RJjti1ItlRvDrHogh85ksY1110EIXls8THYVNeHzFtu-NgkZB2mZQ0Cd5OVlzyKa4f17CDEtocn569JsMsroeN80wyLraKVUTpZ-ATo_OPe6EO2HEjS37VFMqSLi90RtBgvwCbbxCDQ==&lang=sage&interacts=eJyLjgUAARUAuQ==).
What's wrong?Max AlekseyevThu, 22 Sep 2022 23:02:13 +0200https://ask.sagemath.org/question/64141/How to extract a list from the result of Hrepresentation?https://ask.sagemath.org/question/64111/how-to-extract-a-list-from-the-result-of-hrepresentation/ In SageMath, I use the following command to compute Hrepresentations.
P1 = Polyhedron(vertices = [[3, 1, 5, 3], [3, 1, 4, 4], [3, 1, 3, 5], [2, 2, 5, 3], [2, 2, 4, 4], [2, 2, 3, 5], [1, 3, 4, 4], [1, 3, 3, 5]])
r1=P1.Hrepresentation()
r1
The result I got is
(An equation (0, 0, 1, 1) x - 8 == 0,
An equation (1, 1, 0, 0) x - 4 == 0,
An inequality (-1, 0, 0, 0) x + 3 >= 0,
An inequality (1, 0, 0, 1) x - 5 >= 0,
An inequality (1, 0, 0, 0) x - 1 >= 0,
An inequality (0, 0, 0, -1) x + 5 >= 0,
An inequality (0, 0, 0, 1) x - 3 >= 0)
How to get the list
[ [0,0,1,1], [1,1,0,0], [-1,0,0,0], [1,0,0,1], [1,0,0,0], [0,0,0,-1] ]
from r1? Thank you very much.
lijr07Tue, 20 Sep 2022 15:19:58 +0200https://ask.sagemath.org/question/64111/Install pypolymake on SageMathhttps://ask.sagemath.org/question/64075/install-pypolymake-on-sagemath/ I am trying to install pypolymake on SageMath. I follow the method in https://pypi.org/project/pypolymake/
I tried to use the command:
sage -pip install pypolymake
but it has errors:
note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure
× Encountered error while trying to install package.
╰─> pypolymake
note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.
How to install polymake on SageMath? Thank you very much.lijr07Sun, 18 Sep 2022 12:01:36 +0200https://ask.sagemath.org/question/64075/Checking whether a fan is projective: any way to get it faster?https://ask.sagemath.org/question/61045/checking-whether-a-fan-is-projective-any-way-to-get-it-faster/I need to check whether a certain complete fan in R^3 is projective or not. What I tried was export the fan to macaulay2, and apply isPolytopal. However, while completeness is checked in like 30 sec, the polytopality gets stuck, the program doesn't finish in any reasonable time (we left it running for the night, with no result). My question is: are there any more effective ways of checking whether fans are polytopal or not?
Just in case, attached is my code:
macaulay2('loadPackage "Polyhedra"')
L = ToricLattice(4)
Q = ToricLattice(3)
h = L.hom([[1,0,0],[0,1,0],[0,0,1],[-1,-1,-1]],Q)
#rays in sage:
rays = [h((0,2,0,1)),h((0,3,0,2)),h((0,3,1,2)),h((0,5,2,3)),h((0,4,1,2)),h((0,1,0,1)),h((0,1,1,1)),h((0,3,2,2)),h((0,2,1,1)),h((0,0,0,1)),h((0,0,1,1)),h((0,0,1,0)),h((0,3,1,1)),h((1,0,1,1)),h((0,1,0,0)),h((1,0,0,1)),h((1,0,0,0)),h((1,3,0,1)),h((0,4,0,1)),h((1,1,0,1)),h((2,3,0,2)),h((1,2,0,1)),h((0,3,0,1)),h((1,3,0,2)),h((2,5,0,3)),h((1,4,0,2)),h((0,5,0,2))]
#exporting rays to Macaulay
raylist = []
for i in rays:
a = i[0]
b = i[1]
c = i[2]
raylist.append(macaulay2(f'{a},{b},{c}'))
newraylist = []
for i in raylist:
newraylist.append(macaulay2(f'toList{i}'))
#cones in sage:
cones=[(1,2,6),(2,3,6),(3,4,8),(1,5,6),(3,6,7),(3,7,8),(5,6,9),(6,7,11),(7,8,11),(6,9,10),(6,10,11),(8,11,12),(8,12,18),(10,11,13),(11,12,14),(11,13,16),(11,14,16),(13,15,16),(14,16,17),(15,16,19),(16,17,21),(17,18,21),(16,19,20),(16,20,21),(18,21,22),(19,20,24),(20,21,24),(21,22,26),(19,23,24),(21,24,25),(21,25,26),(0,2,3,4),(12,14,17,18),(9,10,13,15),(9,15,19),(8,18,22),(5,9,19),(1,5,19),(1,19,23),(0,1,2,23),(0,23,24,25),(22,26,8),(0,4,25,26),(4,8,26)]
#creating the fan in macaulay with cones as above
macaulay2('Z = coneFromVData matrix {{0,0,0},{0,0,0},{0,0,0}}')
macaulay2('F = fan Z')
conelist = []
for cone in cones:
if len(cone) == 3:
macaulay2(f'v1 = vector {newraylist[cone[0]]}');
macaulay2(f'v2 = vector {newraylist[cone[1]]}');
macaulay2(f'v3 = vector {newraylist[cone[2]]}');
macaulay2('C = coneFromVData matrix {v1,v2,v3}');
macaulay2('F = addCone(C,F)')
if len(cone) == 4:
macaulay2(f'v1 = vector {newraylist[cone[0]]}');
macaulay2(f'v2 = vector {newraylist[cone[1]]}');
macaulay2(f'v3 = vector {newraylist[cone[2]]}');
macaulay2(f'v4 = vector {newraylist[cone[3]]}');
macaulay2('C = coneFromVData matrix {v1,v2,v3,v4}');
macaulay2('F = addCone(C,F)')
#checking completeness and polytopality
macaulay2('isComplete F')
macaulay2('isPolytopal F')PolydaryaThu, 10 Feb 2022 14:55:45 +0100https://ask.sagemath.org/question/61045/Hasse diagram of different dimensional cells of a polyhedronhttps://ask.sagemath.org/question/59311/hasse-diagram-of-different-dimensional-cells-of-a-polyhedron/I am trying to get a facet poset diagram of a polyhedron.
What I want is an adjacency matrix describing the Hasse diagram/poset
where vertices are cells, and two vertices are connected by an edge
if one of their corresponding cells is contained in the other.
So I want a Hasse diagram where the top row consists of a vertex
for the highest dimensional cell, then the next row consists of
cells of one less dimension, and so on until the final row
corresponding to vertices.
For instance, I have:
E = polytopes.dodecahedron().face_lattice()
I don't know how to extract this kind of information from this.
I want to be able to plot the cell poset diagram in some other software to look at it.arboreal_vfSun, 10 Oct 2021 09:01:44 +0200https://ask.sagemath.org/question/59311/how do I enumerate the integer lattice points contained in a convex polyhedron?https://ask.sagemath.org/question/58402/how-do-i-enumerate-the-integer-lattice-points-contained-in-a-convex-polyhedron/ The following Sage code is working perfectly. It generates the polyhedron from a vertex list of interest and computes the Ehrhart polynomial.
p = Polyhedron(vertices = vertex_list)
p = p.ehrhart_polynomial(engine = 'latte')
How can I now compute the number of integer lattice points inisde the convex hull of the polyhedron?
Moreover, can I enumerate them?Justin McClungTue, 10 Aug 2021 19:52:09 +0200https://ask.sagemath.org/question/58402/How to use faces of a polytope as variables?https://ask.sagemath.org/question/57027/how-to-use-faces-of-a-polytope-as-variables/ Hello, I am very new to using computer algebras system, and I can't figure out the following: I need to create a 3D polytope (in fact, an associahedron) and then do some computations in the algebra of rational functions in variables that correspond to faces of associahedron. How do I do that? I know writing something like Frac(ZZ['x,y,z']) creates the algebra that I need, but how do I make formal symbols x,y,z remember that they once were faces of a polytope (so that I could check if one was a subface of another, or something like that...)?PolydaryaSat, 08 May 2021 21:44:28 +0200https://ask.sagemath.org/question/57027/Extracting inequalities for polytopeshttps://ask.sagemath.org/question/53826/extracting-inequalities-for-polytopes/Here is a buckyball
bb = polytopes.buckyball()
rep = bb.Hrepresentation()
show(rep)
and its Hrepresentation. When i ask for say
rep[10]
Sagemath returns the 10th inequality in a way that i coud not use it. Is there a way to obtain explicit inequalities for the polytopes ?
If i type
eq0 = rep[0]
I have an acceptable answer with $x_1$ and $x_2$, but I do not know how to call either $x_1$ or $x_2$ to reuse that inequality in say a linear program.CyrilleSun, 11 Oct 2020 08:19:03 +0200https://ask.sagemath.org/question/53826/rotating polytope in 4d?https://ask.sagemath.org/question/52652/rotating-polytope-in-4d/ So back in the day, when one had to install a viewer separately to see 3D stuff in Sage... when one plotted a 4-polytope in Sage, there were popup menu options for rotating the image in other than the visible 3 dimensions.
How does this work now? (Or how is it supposed to work?) None of my students are able to find controls of any kind; we have people on Macs, PCs, Linux. Everyone is in Sage 9.0 or 9.1.smbelcasFri, 24 Jul 2020 16:28:21 +0200https://ask.sagemath.org/question/52652/