0

So basically I'm being asked in class to solve an inequality -1<(7-x)/3<=4, and the teacher wants the answer of what will become two sets of code on the same line using solveset. So this ends up being solveset(-1<((7-x)/3),x,domain=S.Reals) and solveset (((7-x)/3)<=4,x,domain=S.Reals) But whenever I end up putting & or and in between them to get them on that same line output, I get either the answer to the first OR the answer to the second, which is the complete opposite of what I want. How should I be inputting this? I'm using Jupyter Python stuff. Specifically we've imported sympy stuff.

New Dev
  • 48,427
  • 12
  • 87
  • 129
  • What is your desired output format? Maybe a tuple `solevset(...), solveset(...)`? – Chris_Rands Sep 21 '20 at 21:14
  • the issue is that he wants it to ouput with something like Union(Interval.open(. . .), Interval.open(. . . )) If I do as you suggest I don't get the Union – Madison Boutwell Sep 21 '20 at 21:19
  • `solveset(-1<((7-x)/3), x, domain=S.Reals) & solveset (((7-x)/3)<=4, x, domain=S.Reals)` will correctly give you the solution, i.e., `Interval.Ropen(-5, 10)` which means `[-5, 10)` – abc Sep 21 '20 at 21:26
  • thank you abc! I have no clue what little thing I missed but it works on my end. – Madison Boutwell Sep 21 '20 at 21:30

1 Answers1

0

abc has answered! "solveset(-1<((7-x)/3), x, domain=S.Reals) & solveset (((7-x)/3)<=4, x, domain=S.Reals) will correctly give you the solution, i.e., Interval.Ropen(-5, 10) which means [-5, 10)"