I didn't look into it, but my guess is that the log is only expanded
if the expansion hints are hit on the expression in a particular
order.  Unfortunately, we still have in Expr.expand:

for hint, use_hint in hints.iteritems():
    <expand>

where hints is a dictionary of the hints.  But the order of
dict.iteritems() is *completely* arbitrary, and as far as I know isn't
even guaranteed to be the same for the exact same dictionary within
the same session.

So we need to get rid of these non-determinisms in the code that are
not even related to hashing (which at least is always the same on the
same architecture).  They're basically always related to iterating
over an unordered sequence and having the result depend on the order
of iteration.  By the way, I had a similar problem in my integration3
branch relating to iterating over a set, which I wrote a blog post
about some time ago. See
http://asmeurersympy.wordpress.com/2011/06/05/nondeterminism/.

Aaron Meurer

On Thu, Oct 13, 2011 at 4:12 PM, Mateusz Paprocki <matt...@gmail.com> wrote:
> Hi,
>
> On 13 October 2011 15:00, Vladimir Perić <vlada.pe...@gmail.com> wrote:
>>
>> On Thu, Oct 13, 2011 at 8:31 PM, Tom Bachmann <e_mc...@web.de> wrote:
>> > Hi all,
>> >
>> > when rebasing my branch onto master, I suddenly get a test failure at
>> > line
>> > 727 of sympy/solvers/tests/test_solvers.py. It took me quite a while to
>> > notice the following, *in master*:
>> >
>> > % git checkout master
>> > Already on 'master'
>> > % bin/isympy
>> > IPython console for SymPy 0.7.1-git (Python 2.6.7-64-bit) (ground types:
>> > python)
>> >
>> > In [1]: print solve((2**exp(y**2/x) + 2)/(x**2 + 15), y)
>> > Out[1]: [-sqrt(x)*sqrt(-log(log(2)) + log(log(2) + I*pi)),
>> > sqrt(x)*sqrt(-log(log(2)) + log(log(2) + I*pi))]
>> >
>> > Notice that this is *not* what the unit test expects. So there seems to
>> > be
>> > an issue vaguely related to caching / ordering of tests: on my branch,
>> > Out[1] is what is returned in the test, whence it fails.
>> >
>> > Could someone who knows this code investigate what is going on?
>> > Actually,
>> > can anyone reproduce this behaviour?
>>
>> This is what I get on current master (ff8445e):
>>
>> In [1]: print solve((2**exp(y**2/x) + 2)/(x**2 + 15), y)
>> [-sqrt(x)*sqrt(-log(log(2)) + log(log(2) + I*pi)),
>> sqrt(x)*sqrt(-log(log(2)) + log(log(2) + I*pi))]
>>
>> Which looks the same as your result. I also don't have any failures in
>> the tests, though. Perhaps I misunderstood you?
>
> There is a difference between what is showed here and what is in tests. See
> here: https://gist.github.com/1285687. The results seem equivalent up to
> expansion of the logarithm (unless there are assumptions that I overlook).
>>
>> >
>> > Regards,
>> > Tom
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "sympy" group.
>> > To post to this group, send email to sympy@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > sympy+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/sympy?hl=en.
>> >
>> >
>>
>>
>>
>> --
>> Vladimir Perić
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "sympy" group.
>> To post to this group, send email to sympy@googlegroups.com.
>> To unsubscribe from this group, send email to
>> sympy+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/sympy?hl=en.
>>
>
> Mateusz
>
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To post to this group, send email to sympy@googlegroups.com.
> To unsubscribe from this group, send email to
> sympy+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/sympy?hl=en.
>

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

Reply via email to