sympy/sympy.github.com

subs gets confused on cyclical substitutions

dangyogi opened this issue · 1 comments

(x + y).subs(((x, y), (y, x))) gives 2x, expected y + x (or x + y after simplification).

@dangyogi thanks for the report. Please report issues in the sympy repository at https://github.com/sympy/sympy/issues, not here. I am going to close this one.

Regarding the issue itself, the way subs works is that it first substitutes x -> y, so x+y becomes y+y=2*y, and then it substitutes y->x, so 2*y becomes 2*x, as sympy returned.