Comment #2 on issue 2440 by renato.c...@gmail.com: Equal Integrals compare different when using different variables
http://code.google.com/p/sympy/issues/detail?id=2440

My view is that dummy symbols shouldn't make a difference when comparing objects. In Integral you don't change all variables for dummies, but they are still bound symbols, and changing them does not alter the expression. Since the two expressions compare equal, the result is the same -- although printing may differ.

That seems to depend on the order, so that the result has the symbol of the first term. For instance, in my eval_deriv2 branch:

In [1]: Subs(f(x), x, 0) + Subs(f(y), y, 0)
Out[1]:
2⋅(f(x))│
        │x=0

In [2]: Subs(f(y), y, 0) + Subs(f(x), x, 0)
Out[2]:
2⋅(f(x))│
        │x=0

But running the same with cache disabled, it gives:

In [2]: Subs(f(y), y, 0) + Subs(f(x), x, 0)
Out[2]:
2⋅(f(y))│
        │y=0

So cache will return the symbol first used for that operation, even if that symbol does not even appear. If I do then (with cache enabled):

In [3]: Subs(f(t), t, 0) + Subs(f(z), z, 0)
Out[3]:
2⋅(f(x))│
        │x=0

So, although this is a bit arbitrary, at least it's not hash-dependant, and it's not expected to behave differently on different systems. Do you think this printing issue is a problem?

BTW, all of this only applies to definite integrals. Of course, for indefinite integrals, the variables of integration are free symbols, not dummies.

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

Reply via email to