Sympy's subs function does not seem to be able to recognize negative multi-term expressions...
x,y = symbols('x,y') e1_, e2_ = symbols('e1, e2') e1 = x e2 = 1+x [(e1).subs(e1,e1_), (-e1).subs(e1,e1_), (e2).subs(e2,e2_), (-e2).subs(e2,e2_)] produces: [e₁, -e₁, e₂, -x - 1] Is there a reason why this can't or shouldn't be done? -- 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/-/wX5ydFpohb8J. 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.