Newbie question: Simplifying rational inequality results



Here is a case where %solve gets results like -1=0:

(%i21) %solve(abs(x^2-3)<=1,x);
(%o21)
%union([-2<x,x<2,x^2-2>0],[x=-2,1=0],[x=-2,1>0],[x=2,1=0],[x=2,1>0],[-(x^2-3)>0,x^2-2=0])

It also includes things like x^2-2>0 which it should be able to eliminate,
but it can't even in isolation (!?):

(%i24) %solve(x^2<2,x);
(%o24) %union([2-x^2>0])

Maxima 5.30.0 / SBCL / OSX


On Fri, Jun 28, 2013 at 1:22 PM, Stavros Macrakis <macrakis at alum.mit.edu>wrote:

> Fortunately, Maxima *does* have a package that solves your equation.
>
> load(to_poly_solve)$
>
> %solve(abs((x-1)/(x-5))<=1/3,x)
>     =>
> %union([-1<x,x<1],[1<x,x<2],[x=-1],[x=1],[x=2])
>
>
> This is still not ideal -- the various cases come down do -1 <= x, x <=2
> -- but still, better than what you had.
>
>        -s
>
>
>
> On Fri, Jun 28, 2013 at 12:25 PM, Robert Pollak <robert.pollak at jku.at>wrote:
>
>> Am 28.06.2013 15:35, schrieb Stavros Macrakis:
>> > There seems to be a typo in your example -- it won't parse. I tried
>> > ineq:... instead of ineq=..., and tried removing ineq=, but that yields
>> > an error from solve_rat_ineq.  Tested in Maxima 5.28.0 and 5.30.0 / SBCL
>> > / OSX / wxMaxima.  Also, "==" (in your output) is not a standard Maxima
>> > operator (does a newer version of solve_rat_ineq define it?).
>> >
>> > * What is the exact input you used?
>> > * What is the version of Maxima you used?
>> > * Are you using the version of solve_rat_ineq that came with Maxima, or
>> > some other version?
>> >
>> > Complete and reproducible problem reports help us help you.
>>
>> Sure. I am sorry for having posed my question in such a bad form. The
>> reason is that I am not using Maxima directly, but via Sage 5.4 instead
>> (which says maxima.version() = 5.26.0).
>>
>> In Sage, when I enter
>>
>> solve(abs((x-1)/(x-5)) <= 1/3, x)
>>
>> I get the 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]]
>>
>> Since I did not know Maxima, I naively assumed this to be the log of the
>> Maxima call.
>>
>> I have now installed Maxima-5.28.0-2. Unfortunately, as Volker has
>> explained in the meantime, solve_rat_ineq cannot deal with 'abs':
>>
>> (%i1) load("solve_rat_ineq");
>> (%o1)
>>
>> "C:/PROGRA~2/MAXIMA~1.0-2/share/maxima/5.28.0-2/share/solve_rat_ineq/solve_rat_ineq.mac"
>> (%i2) solve_rat_ineq(abs(x-1)/abs(x-5) <= 1/3);
>> solve_rat_ineq:  abs(x-1)/abs(x-5)<=1/3  is not rational.
>> #0: solve_rat_ineq(ineq=abs(x-1)/abs(x-5) <= 1/3)(solve_rat_ineq.mac
>> line 59)
>>  -- an error. To debug this try: debugmode(true);
>>
>> So I assume that Sage does the case distinction for the 'abs' function
>> by itself and calls Maxima on each case separately, like
>>
>> (%i5) solve_rat_ineq((x-1)/(x-5) <= 1/3);
>> (%o5) [[x>=-1,x<5]]
>>
>> Therefore I will move my question over to the Sage people, since there
>> seems to be no way to solve "abs(x-1)/abs(x-5) <= 1/3" in Maxima.
>>
>> Sorry again, and best regards,
>> Robert
>>
>>
>