Vinzent Steinberg wrote:
> On 11 Apr., 23:56, Ronan Lamy <[email protected]> wrote:
>> Le lundi 11 avril 2011 à 15:42 -0600, Aaron S. Meurer a écrit :> On
>> Apr 11, 2011, at 2:25 AM, smichr wrote:
>>
>>>> Should `Integral(x, (x, 1, 2)) == Integral(y, (y, 1, 2))` be True?
>>>> If so, smichr branch 2068b has a commit that makes this testing
>>>> possible.
>>
>>> This is a good question. For one thing, == is not mathematical
>>> equality but exact equality, so there is no reason why it should
>>> have to be True. So my initial response is that no, it should not.
>
> Intuitively I would say that they should only be equal if there
> internal representation is the same. In this case it is not, because
> they print differently. But, on the other hand we have:
>
>>>> 2 == 2.0
> True
>
> So I tend to agree with Ronan.
>
>> I think it should. x and y are bound symbols that have no meaning
>> outside the integrals, so their identity should be completely
>> irrelevant. In fact, they should probably be replaced with dummies
>> upon
>> instantiation of the Integral.
>
> Are you proposing a behavior like
>
>>>> Integral(x, x)
> Integral(_x1, _x1)
>>>> Integral(y, y)
> Integral(_x1, _x1)
>
> ? (Where _x1 is an arbitrary dummy variable.)
We might as well, since that y or x is inaccessible through subs anyway. If you
look at the .as_dummy() representation of the Integral in my branch they both
will show
Integral(_0, (_0, x))
Integral(_0, (_0, y))
They are different because of the indefinite limit. But if you put a (x, 1, 2)
and (y, 1, 2) in for limits then they would both be the same:
Integral(_0, (_0, 1, 2))
Also, regarding limit order. Although I don't (due to limited insight)
understand how changing the limits changes the computational difficulty of the
integral, the integral is not being performed when doing the equality testing.
The sorted-as-much-as-possible limits are being compared after getting their
dummy representation.
/c
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sympy?hl=en.