Reputation: 1021
I am using sympy to solve a simple inequality. After solving it, I want to assign the right hand side of the solution to a new variable.
from sympy.solvers.inequalities import reduce_rational_inequalities
from sympy import Symbol
x = Symbol('x', real=True)
sol = reduce_rational_inequalities([[x*0.2 >= 1]], x)
print type(sol), '\n', sol
>> <class 'sympy.core.relational.GreaterThan'>
x >= 5.0
I have tried
rhs = sol.rhs()
>> TypeError: 'Float' object is not callable
Is there any way I can achieve this?
Upvotes: 0
Views: 3037
Reputation: 177058
You don't need the parentheses here, .rhs
is an attribute. You can write:
rhs = sol.rhs
sol.rhs
will return a SymPy Float
object.
Upvotes: 2