Ask Your Question
1

simplifying rational inequality results

asked 2013-06-28 05:10:21 +0100

updated 2013-06-28 09:23:43 +0100

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 10:40:34 +0100 )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 21:34:39 +0100 )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-07-01 04:28:40 +0100 )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 14:04:57 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-07-02 10:46:43 +0100

updated 2015-10-30 09:09:48 +0100

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-28 05:10:21 +0100

Seen: 961 times

Last updated: Oct 30 '15