Unexpected weakness in sympy substitution

26 views
Skip to first unread message

Coleman Broaddus

unread,
Feb 25, 2012, 5:22:03 PM2/25/12
to sy...@googlegroups.com
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?

Mateusz Paprocki

unread,
Feb 25, 2012, 5:29:41 PM2/25/12
to sy...@googlegroups.com
Hi,

This was a bug in SymPy 0.7.1 and before. It's fixed in git version (see http://github.com/sympy/sympy) and will be part of 0.7.2 release.
 

--
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 sy...@googlegroups.com.
To unsubscribe from this group, send email to sympy+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sympy?hl=en.

Mateusz
Reply all
Reply to author
Forward
0 new messages