On Monday, July 1, 2013 5:37:02 AM UTC-4, Robert Pollak wrote: > > Hello list! > > I have already posted the following question to the Maxima mailing list > [1], > but I am not sure whether corresponding improvements should go into Sage > or Maxima. > > In Sage 5.4, when I enter > > solve(abs((x-1)/(x-5)) <= 1/3, x) > > I get the following DNF as output > > #0: solve_rat_ineq(ineq=abs(x-1)/abs(x-5) <= 1/3) > [[x == -1, -6 != 0, -6 != 0], [x == -1, -6 != 0, -6 != 0, -6 != 0], [x > == -1, -6 != 0, -6 != 0], [x == -1, -6 != 0, -6 != 0, -6 != 0], [x == 2, > -3 != 0, -3 != 0], [x == 2, -3 != 0, -3 != 0, -3 != 0], [x == 2, -3 != > 0, -3 != 0], [x == 2, -3 != 0, -3 != 0, -3 != 0], [x == 1], [1 < x, x > < 2], [-1 < x, x < 1]] > > >
> The main issue is that the result should be > > [[-1 <= x, x <= 2]] > > , where terms like '-6 != 0' are evaluated and the intervals are merged. > > As you see in your examples below, to_poly_solve and fourier_elim in Maxima simply don't return their information like that, they return them as a union of open intervals and points. It would be possible to try to merge those intervals, but likely at a large computational cost (since a generic solution probably won't piece together so nicely). So I don't know whether it would be worth it to try to do that. > If we had a function that eliminates the constant inequalities and (for > the univariate case) merges the intervals, this function could be applied > to the result of solve_ineq before returning. Would this be the correct way > to fix this issue? > > Presumably, yes. > By the way, I do not really understand which Maxima function generates the > current result. According to the Maxima list thread, both 'to_poly_solve' > and 'fourier_elim' do not generate the '-6 != 0' terms: > > sage: F = abs((2*x-2)/(x-5)) <= 2/3 sage: F0 = [F._maxima_()] sage: F0 [2*abs(x-1)/abs(x-5)<=2/3] sage: F0[0] 2*abs(x-1)/abs(x-5)<=2/3 sage: F0[0].parent() Maxima_lib sage: F0[0].parent().fourier_elim(F0,[x]) [x=-1,-6#0,-6#0]or[x=-1,-6#0,-6#0,-6#0]or[x=-1,-6#0,-6#0]or[x=-1,-6#0,-6#0,-6#0]or[x=2,-3#0,-3#0]or[x=2,-3#0,-3#0,-3#0]or[x=2,-3#0,-3#0]or[x=2,-3#0,-3#0,-3#0]or[x=1]or[1<x,x<2]or[-1<x,x<1] which is a Maxima object, and that is what generates it. But I have trouble getting this to happen in the Maxima console. (%i5) g:2*abs(x-1)/abs(x-5)<=2/3; 2 abs(x - 1) 2 (%o5) ------------ <= - abs(x - 5) 3 (%i6) fourier_elim(g,[x]); (%o6) [x = - 1] or [x = 2] or [x = 1] or [1 < x, x < 2] or [- 1 < x, x < 1] (%i7) fourier_elim([g],[x]); (%o7) [x = - 1] or [x = 2] or [x = 1] or [1 < x, x < 2] or [- 1 < x, x < 1] I feel like this might have something to do with the fact we're using the binary ECL interface, maybe? -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/groups/opt_out.