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]]

This has two issues:

The minor one is that as a Sage newbie, I was confused by the line containing 
'solve_rat_ineq'. I the meantime I learned that this just seems to be a 
byproduct of a failed try to use this function (because solve_rat_ineq cannot 
deal with 'abs'). Maybe Sage should give something more explicit like "Failed 
to use solve_rat_ineq" instead, or not print the line at all?

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.

I am a Sage newbie, just having browsed its code the first time, and I see that 
solve_rat_ineq is called by solve_ineq_univar in sage/symbolic/relation.py, 
which itself is called by solve_ineq. (Therefore I am CCing the relevant author 
Robert Marik.)

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?

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:

Stavros Macrakis proposed:

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])

and Volker van Nek gave:

load(fourier_elim);
fourier_elim([abs((x-1)/(x-5))<=1/3],[x]);
=>
[x = - 1] or [x = 2] or [x = 1] or [1 < x, x < 2] or [- 1 < x, x < 1]

Best regards,
Robert


[1] http://thread.gmane.org/gmane.comp.mathematics.maxima.general/42727/

-- 
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.


Reply via email to