Hello everyone,

I think I identified a bug. It originated in two sets not being equal.
Here i will write sqrt instead of Pow(..., Rational(1, 2)) for readability.
{exp(sqrt(3/8)), exp(-sqrt(3/8)} and {exp(sqrt(2)*sqrt(3)/4), 
exp(-sqrt(2)*sqrt(3/4)}

After going deep into this bug, it appears the problem lies with the 
ordering function of FiniteSet.

FiniteSet seems to order improperly the first set, and this cannot do the 
correct comparison.
the function 'ordered' seems to have trouble with Pow(...., Rational(1, 2)) 
because it works correctly when I use
Pow(...., S.Half).

Is there is a reason for this behaviour ? It seems the two mechanisms 
should give the same results.
Also to be noted, the raw comparison ( < ) gives the correct result no 
matter the arguments.


Here is the minimal failing test I could come up with exhibiting the 
behaviour
    from sympy import Pow, Rational                                         
   
    l = [Pow(3, Rational(1, 2)), -Pow(3, Rational(1, 2))]                   
   
    assert list(ordered(tuple(l), warn=True)) == [-Pow(3, Rational(1, 2)), 
Pow(3, Rational(1, 2))]

I am still trying to figure out why there is a difference, but I want to 
make sure there is not some intended purpose for this.


Cheers,
Nicolas Patry

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sympy.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sympy/2d73e756-7450-4d69-be95-8e2cdb493bb5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to