Hullo Sympy Group,

I have a series of relations that I am receiving from an outside object and 
code base.  These equations are in no particular format, and I want to 
convert them to one.  At the moment, the end format I need is

format:  lhs_expression   [op]  constant
example: 3x + 4y <= 7

I have code that currently looks like this:

-----
*lhs, rhs = rel.lhs, rel.rhs*
*lhs -= rhs*
*rhs = 0*
*
*
*possible_constant = lhs.as_ordered_terms()[ -1 ]*
*if possible_constant.is_real:*
* lhs -= possible_constant*
* rhs -= possible_constant*
*new_relation = type(rel)(lhs, rhs)*
-----

Given that Sympy has already parsed the *lhs* expression, is there a more 
efficient/cleaner method of getting its constant?  Something perhaps like:

-----
*lhs, rhs = rel.lhs, rel.rhs*
*lhs -= rhs*
*rhs = -lhs.constant_term*
*lhs -= rhs*
*new_relation = type(rel)(lhs, rhs)*
-----

Thanks,

Kevin

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/sympy/-/8OcaZ8uoLBwJ.
To post to this group, send email to sympy@googlegroups.com.
To unsubscribe from this group, send email to 
sympy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sympy?hl=en.

Reply via email to