2022-06-02 20:22:03 +0200 | received badge | ● Nice Question (source) |
2021-01-31 15:05:23 +0200 | received badge | ● Notable Question (source) |
2019-10-26 13:26:22 +0200 | received badge | ● Popular Question (source) |
2017-06-20 01:08:55 +0200 | received badge | ● Famous Question (source) |
2016-05-09 20:18:52 +0200 | received badge | ● Notable Question (source) |
2016-05-09 20:18:52 +0200 | received badge | ● Popular Question (source) |
2014-08-13 20:54:13 +0200 | commented question | enumerate integer points in a polytope You are right. It took one full day for the code to finish running. It gave about 75500 vectors. I found that the problem has another constraint. I am only looking for integer vectors that belong to $S$ and have 4 or less non-zero elements. But $\sum_{i=1}^n |x_i| \leq 4$ is a convex constraint. Polyhedron seems to take only linear equality and inequality constraints.. Is there a way to add the L_1 norm constraint? |
2014-08-06 18:42:23 +0200 | received badge | ● Nice Question (source) |
2014-08-03 05:48:46 +0200 | asked a question | enumerate integer points in a polytope This is a followup question to http://ask.sagemath.org/question/2366... $A$ is a $5 \times 19$ matrix. $S=${-1,0,1}. As suggessted in the solution I compute integral points within a polytope. I have the following code: eq3=[ (0,6,10,10,6,6,6,3,3,0,3,21,21,0,0,3,3,3,3,3), (0,12,16,15,13,13,14,7,7,2,8,27,27,1,2,7,7,5,4,6), (0,6,13,10,9,9,12,6,6,4,10,14,14,0,1,7,7,6,3,3), (0,0,5,5,0,0,0,0,0,0,0,7,7,0,0,0,0,0,0,0), (0,0,3,2,1,1,2,1,1,1,2,2,2,0,0,1,1,1,0,0)]; ineq3=[ (-lb,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(ub,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), (-lb,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(ub,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), (-lb,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(ub,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), (-lb,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(ub,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0), (-lb,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0),(ub,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0), (-lb,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0),(ub,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0), (-lb,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0),(ub,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0), (-lb,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0),(ub,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0), (-lb,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0),(ub,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0 ... (more) |
2014-08-02 22:09:47 +0200 | answered a question | Solving system of linear Diophantine equations Dear Dima, Thank you for the solution. It works well. I am putting the example code here. lb=-1; ub=1; A=matrix(ZZ,[(8,2,10,0,12,2,0),(4,6,9,1,14,5,2),(2,0,1,1,0,1,0),(2,1,3,0,4,0,1)]); eq1=[(0,8,2,10,0,12,2,0),(0,4,6,9,1,14,5,2),(0,2,0,1,1,0,1,0),(0,2,1,3,0,4,0,1)]; ineq1=[ (-lb,1,0,0,0,0,0,0),(ub,-1,0,0,0,0,0,0), (-lb,0,1,0,0,0,0,0),(ub,0,-1,0,0,0,0,0), (-lb,0,0,1,0,0,0,0),(ub,0,0,-1,0,0,0,0), (-lb,0,0,0,1,0,0,0),(ub,0,0,0,-1,0,0,0), (-lb,0,0,0,0,1,0,0),(ub,0,0,0,0,-1,0,0), (-lb,0,0,0,0,0,1,0),(ub,0,0,0,0,0,-1,0), (-lb,0,0,0,0,0,0,1),(ub,0,0,0,0,0,0,-1)]; p=Polyhedron(eqns=eq1,ieqs=ineq1,base_ring=QQ) p.integral_points() returns the answer ((-1, -1, 1, 1, 0, 0, 0), (0, -1, -1, 1, 1, 0, 0), (0, -1, 0, -1, 0, 1,1), (0, 0, 0, 0, 0, 0, 0), (0, 1, 0, 1, 0, -1, -1), (0, 1, 1, -1, -1, 0,0), (1, 1, -1, -1, 0, 0, 0)) which is exactly what i needed. Thanks again. |
2014-08-02 22:05:14 +0200 | received badge | ● Scholar (source) |
2014-08-02 12:31:26 +0200 | received badge | ● Student (source) |
2014-08-02 12:23:16 +0200 | received badge | ● Editor (source) |
2014-08-02 12:17:47 +0200 | asked a question | Solving system of linear Diophantine equations I have an $m \times n$ integer matrix $A$ with $m>n$, and a set $S \subset \mathbb{Z}$, for example $S=\{-1,0,1\}$. I want to enumerate all possible $X \in S^n$ such that $AX=0$. I tried using smith_form(), but then i could not figure out how to force the solution to belong to elements of $S$. EDIT. Thank you Dima for the solution. It works well. I am adding an example here to illustrate your solution. returns the answer which is exactly what i needed. Thanks again. |