Trying to solve relational, compound equation inequality. e.g -3 < 2x+1 < 5

30 views
Skip to first unread message

virajt...@gmail.com

unread,
Mar 24, 2017, 3:34:32 AM3/24/17
to sympy
I am following the steps:

1. import sympy as sy
2. x = sy.symbols('x', real=True)

Now, print(sy.solve(2*x + 1 < 5,x)) or (-3 < 2*x+1, x) giving me the appropriate answer. But when i try to run, print(sy.solve(-3 < 2x+1 <5, x)), it is giving me the error raise TypeError("cannot determine truth value of Relational")
TypeError: cannot determine truth value of Relational
.

I am very new to sympy and i am struggling from this for last two days. if anyone have idea please share it. Thank you in advance. i want that single value from result as well. 

Jason Moore

unread,
Mar 25, 2017, 7:47:14 PM3/25/17
to sy...@googlegroups.com
You need to pass in two separate equations instead of the expression.

--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscribe@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/a1c02acf-7c81-4ca6-82c8-ee904820b61f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages