Ask Your Question
1

simplifying rational inequality results

asked 2013-06-27 22:10:21 -0500

updated 2013-06-28 02:23:43 -0500

The command

solve(abs((2*x-2)/(x-5)) <= 2/3, x)

yields

#0: solve_rat_ineq(ineq=2*abs(x-1)/abs(x-5)-2/3 <= 0)
[[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]]

Is there a way to simplify that output to get something like

[[-1 <= x, x <= 2]]

?

edit retag flag offensive close merge delete

Comments

Not directly within Sage, I think, though as you'll note the union of all those results is indeed the answer you are looking for. Even `solve(abs((x-1)/x)<=1,x)` gives several answers, which union to the correct one. That said, it would be nice to "sanitize" the ones above so that it looks more like `[[x == -1],[-1<x,x\<1],[x =="1],[1&lt;x,x&lt;2]]`" (where="" `<`="" means="" <.<="" p="">

kcrisman gravatar imagekcrisman ( 2013-06-28 03:40:34 -0500 )edit

For other readers - note the same question was asked [here on the Maxima list](http://www.math.utexas.edu/pipermail/maxima/2013/033339.html), with inconclusive results for now (other than what does/doesn't work in Maxima, and which Maxima function creates this).

kcrisman gravatar imagekcrisman ( 2013-06-28 14:34:39 -0500 )edit

@kcrisman, since my question was just a boolean one ("is there a way ..."), I would accept your "not directly within Sage" as an Askbot answer, if you care.

jondo gravatar imagejondo ( 2013-06-30 21:28:40 -0500 )edit

Well, I guess I lied, since Python is presumably Turing-complete! But it's not an easy one-liner, though probably someone could write a tricky one-liner.

kcrisman gravatar imagekcrisman ( 2013-07-01 07:04:57 -0500 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-07-02 03:46:43 -0500

updated 2015-10-30 03:09:48 -0500

Yes, now that there's a QEPCAD package availableand already installed on http://sagecell.sagemath.org and https://cloud.sagemath.com.

Calling

dnf = solve(abs((2*x-2)/(x-5)) <= 2/3, x)
qf = apply(qepcad_formula.or_, map(qepcad_formula.and_, dnf)) # reformat the solution
qepcad(qf, vars='(x)') # simplify

yields

x + 1 >= 0 /\ x - 2 <= 0
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-06-27 22:10:21 -0500

Seen: 520 times

Last updated: Oct 30 '15