to., 21.10.2010 kl. 10.29 -0600, skrev Aaron S. Meurer:
> Well, that's not surprising.  99% of the time, when sympy hangs (but still 
> finishes) it is hanging in expand().   This is a place where a slight machine 
> difference can make a difference, too, because of the way expand works.  
> Basically, it places all the expansion hints in a dictionary, and then 
> executes them in whatever order it pops them out in a for loop (see 
> sympy/core/expr.py, line 895).  So if you have a slightly different order for 
> expansion, it can easily make a difference.  For example, consider
> 
> (x + 1)*(x + 2)**10.  
> 
> If you first expand (x + 2)**10 using the expand_multinomial hint you get x + 
> 1 times 11 terms.  You then expand the (x + 1) around it using the expand_mul 
> hint.  
> 
> But if you instead first expand using the expand_mul hint, you will get x*(x 
> + 2)**10 + (x + 2)**10, and then when you apply the expand_multinomial hint, 
> you have to expand the (x + 2)**10 part TWICE.  (You will actually then have 
> to run the expand_mul hint again to get the completely expanded expression). 
> You can see how this can result in different execution times depending on the 
> hint order.
> 

Shouldn't this be implemented in a more predictable way?  Is it possible
to order the hints in an educated way based on the expression?  If that
is difficult, wouldn't it be better to iterate through the hints in an
arbitrary, but consistent order?

Øyvind

-- 
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.

Reply via email to