On Mon, May 3, 2010 at 12:50 PM, Diego Ruano <dru...@gmail.com> wrote: > Thank you David for your answer. > > What about getting a solution over the integers?
I'm sure of the best way. You could just write your own little function that checks the conditions for each (i,j) in a big rectangle. Also, you might be able to use Sage's MixedIntegerLinearProgram functionality. Hopefully others on this list will have a better idea. > > David Joyner wrote: >> I think Sage calls Maxima and Maxima is getting i (your variable) >> and I (sqrt(-1)) mixed up. I guess this is a bug, but it might be >> known already. >> >> Anyway, using x's and y's might be safer: >> >> sage: x,y = var('x,y') >> sage: ineqs = [2*x+9*y>= - 0, -5*x-7*y>=-5, 3*x-2*y>= -6] >> sage: solve_ineq(ineqs,[x,y]) >> [[x == (-32/31), y == (45/31)], [x == (-54/31), y == (12/31)], [x == >> 2/3*y - 2, (12/31) < y, y < (45/31)], [x == (45/31), y == (-10/31)], >> [x == -7/5*y + 1, (-10/31) < y, y < (45/31)], [x == -9/2*y, (-10/31) < >> y, y < (12/31)], [max(2/3*y - 2, -9/2*y) < x, x < -7/5*y + 1, (-10/31) >> < y, y < (45/31)]] >> >> >> >> >> >> On Mon, May 3, 2010 at 5:04 AM, Diego Ruano <dru...@gmail.com> wrote: >> > Hi, >> > >> > I would like to compute the solution of systems of inequalities over >> > the integers. I have used the command "solve", but the solution is >> > over the complex numbers. >> > >> > Something like: >> > >> > i, j = var('i,j') >> > sol=solve([2*i+9*j>= - 0, -5*i-7*j>=-5, 3*i-2*j>= -6], i,j) >> > sol >> > [[i == (-54/31), j == (12/31)], [i == (-32/31), j == (45/31)], [i == >> > (45/31), j == (-10/31)], [i == -7/5*j + 1, (-10/31) < j, j < >> > (45/31)], [i == -9/2*j, (-10/31) < j, j < (12/31)], [i == 2/3*j - >> > 2, (12/31) < j, j < (45/31)], [max(2/3*j - 2, -9/2*j) < i, i >> > < -7/5*j + 1, (-10/31) < j, j < (45/31)]] >> > >> > Is there any way to get the intersection of the previous set with >> > ZZ^2?, or a command to solve the system over the integers? >> > >> > Thanks, >> > >> > Diego >> > >> > -- >> > To post to this group, send email to sage-support@googlegroups.com >> > To unsubscribe from this group, send email to >> > sage-support+unsubscr...@googlegroups.com >> > For more options, visit this group at >> > http://groups.google.com/group/sage-support >> > URL: http://www.sagemath.org >> > >> >> -- >> To post to this group, send email to sage-support@googlegroups.com >> To unsubscribe from this group, send email to >> sage-support+unsubscr...@googlegroups.com >> For more options, visit this group at >> http://groups.google.com/group/sage-support >> URL: http://www.sagemath.org > > -- > To post to this group, send email to sage-support@googlegroups.com > To unsubscribe from this group, send email to > sage-support+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/sage-support > URL: http://www.sagemath.org > -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org