ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 07 Oct 2015 21:05:42 -0500non-negative integer relations on verticeshttp://ask.sagemath.org/question/29797/non-negative-integer-relations-on-vertices/ I would like to check whether there is a nonnegative integer relations between the vertices of my lattice polytope.
Here is my code (I copied from sage math document):
vertices = [(1,1,-1,-1,-1),(-1,-1,1,1,-1),(1,-1,-1,-1,1),(-1,1,1,1,1),(1,-1,1,-1,-1)]
p = LatticePolytope(vertices)
print p.vertices_pc()
print lattice_polytope.positive_integer_relations(p.vertices_pc().column_matrix())
Obviously, the sum of the first four vectors is zero vector. However, sage returns an error:
> TypeError: unable to make sense of Maxima expression '"Problemnotfeasible!"' in Sage
I would like to understand the reason. Is there some obvious thing I am missing? Interestingly, if I remove the last vertex from the list, then it gives the expected relation. Tue, 06 Oct 2015 12:34:03 -0500http://ask.sagemath.org/question/29797/non-negative-integer-relations-on-vertices/Comment by kcrisman for <p>I would like to check whether there is a nonnegative integer relations between the vertices of my lattice polytope.
Here is my code (I copied from sage math document):</p>
<pre><code>vertices = [(1,1,-1,-1,-1),(-1,-1,1,1,-1),(1,-1,-1,-1,1),(-1,1,1,1,1),(1,-1,1,-1,-1)]
p = LatticePolytope(vertices)
print p.vertices_pc()
print lattice_polytope.positive_integer_relations(p.vertices_pc().column_matrix())
</code></pre>
<p>Obviously, the sum of the first four vectors is zero vector. However, sage returns an error:</p>
<blockquote>
<p>TypeError: unable to make sense of Maxima expression '"Problemnotfeasible!"' in Sage</p>
</blockquote>
<p>I would like to understand the reason. Is there some obvious thing I am missing? Interestingly, if I remove the last vertex from the list, then it gives the expected relation. </p>
http://ask.sagemath.org/question/29797/non-negative-integer-relations-on-vertices/?comment=29813#post-id-29813I've never even seen this error message coming from Maxima! I've opened http://trac.sagemath.org/ticket/19367 for that (not for the bug itself).Wed, 07 Oct 2015 14:55:24 -0500http://ask.sagemath.org/question/29797/non-negative-integer-relations-on-vertices/?comment=29813#post-id-29813Comment by fidbc for <p>I would like to check whether there is a nonnegative integer relations between the vertices of my lattice polytope.
Here is my code (I copied from sage math document):</p>
<pre><code>vertices = [(1,1,-1,-1,-1),(-1,-1,1,1,-1),(1,-1,-1,-1,1),(-1,1,1,1,1),(1,-1,1,-1,-1)]
p = LatticePolytope(vertices)
print p.vertices_pc()
print lattice_polytope.positive_integer_relations(p.vertices_pc().column_matrix())
</code></pre>
<p>Obviously, the sum of the first four vectors is zero vector. However, sage returns an error:</p>
<blockquote>
<p>TypeError: unable to make sense of Maxima expression '"Problemnotfeasible!"' in Sage</p>
</blockquote>
<p>I would like to understand the reason. Is there some obvious thing I am missing? Interestingly, if I remove the last vertex from the list, then it gives the expected relation. </p>
http://ask.sagemath.org/question/29797/non-negative-integer-relations-on-vertices/?comment=29801#post-id-29801I think that this is a bug. Sage sholud be trying to communicate that it cannot find the required relations (since Maxima returned "Problem not feasible!"). You can try looking at the source code for the integer relation function using `lattice_polytope.positive_integer_relations??` (not sure if this will be of any help).Tue, 06 Oct 2015 14:44:26 -0500http://ask.sagemath.org/question/29797/non-negative-integer-relations-on-vertices/?comment=29801#post-id-29801Answer by vdelecroix for <p>I would like to check whether there is a nonnegative integer relations between the vertices of my lattice polytope.
Here is my code (I copied from sage math document):</p>
<pre><code>vertices = [(1,1,-1,-1,-1),(-1,-1,1,1,-1),(1,-1,-1,-1,1),(-1,1,1,1,1),(1,-1,1,-1,-1)]
p = LatticePolytope(vertices)
print p.vertices_pc()
print lattice_polytope.positive_integer_relations(p.vertices_pc().column_matrix())
</code></pre>
<p>Obviously, the sum of the first four vectors is zero vector. However, sage returns an error:</p>
<blockquote>
<p>TypeError: unable to make sense of Maxima expression '"Problemnotfeasible!"' in Sage</p>
</blockquote>
<p>I would like to understand the reason. Is there some obvious thing I am missing? Interestingly, if I remove the last vertex from the list, then it gives the expected relation. </p>
http://ask.sagemath.org/question/29797/non-negative-integer-relations-on-vertices/?answer=29816#post-id-29816Hello,
In the mean time you can use the following simple code
sage: M = matrix(vertices)
sage: nrows = M.nrows()
sage: ncols = M.ncols()
sage: eqns = [[0] + M[i,:].list() for i in range(nrows)]
sage: ieqs = [[0]*i + [1] + [0]*(ncols-i) for i in range(1,ncols+1)]
sage: [r.vector() for r in Polyhedron(eqns=eqns, ieqs=ieqs, base_ring=ZZ).rays()]
[(1, 0, 0, 1, 0)]
VincentWed, 07 Oct 2015 21:05:42 -0500http://ask.sagemath.org/question/29797/non-negative-integer-relations-on-vertices/?answer=29816#post-id-29816Answer by tmonteil for <p>I would like to check whether there is a nonnegative integer relations between the vertices of my lattice polytope.
Here is my code (I copied from sage math document):</p>
<pre><code>vertices = [(1,1,-1,-1,-1),(-1,-1,1,1,-1),(1,-1,-1,-1,1),(-1,1,1,1,1),(1,-1,1,-1,-1)]
p = LatticePolytope(vertices)
print p.vertices_pc()
print lattice_polytope.positive_integer_relations(p.vertices_pc().column_matrix())
</code></pre>
<p>Obviously, the sum of the first four vectors is zero vector. However, sage returns an error:</p>
<blockquote>
<p>TypeError: unable to make sense of Maxima expression '"Problemnotfeasible!"' in Sage</p>
</blockquote>
<p>I would like to understand the reason. Is there some obvious thing I am missing? Interestingly, if I remove the last vertex from the list, then it gives the expected relation. </p>
http://ask.sagemath.org/question/29797/non-negative-integer-relations-on-vertices/?answer=29810#post-id-29810It looks like a bug, you can indeed find your nontrivial relation as follows:
sage: p.vertices().column_matrix().right_kernel()
Free module of degree 5 and rank 1 over Integer Ring
Echelon basis matrix:
[1 1 1 1 0]
It is now [trac ticket 19365](http://trac.sagemath.org/ticket/19365). Thanks for reporting.
Wed, 07 Oct 2015 11:17:30 -0500http://ask.sagemath.org/question/29797/non-negative-integer-relations-on-vertices/?answer=29810#post-id-29810