I'm trying to simplify some expressions with Sympy. However, I wanna filter out some expressions with Add/Sub with constants "before" simplification.
For instance,
parse_expr("abc_mmw * 2 * 5", evaluate=False) => valid
parse_expr("abc_mmw * 2 * 5 + 5", evaluate=False) => invalid (Adding 5, which is a constant)
parse_expr("abc_mmw * 2 * 5 + 5 - 5", evaluate=False) => invalid (Even though it's the same as "abc_mmw * 2 * 5" after simplificaton)
Without evalute=True, it is quite confusing me how to check whether there is an addition/a subtraction with constants or how to get the constants in the expression.
Is there any way to deal with the condition with built-in Sympy functions? Thanks!