On Fri, Nov 30, 2012 at 9:27 PM, Shriramana Sharma <[email protected]> wrote: > On Sat, Dec 1, 2012 at 9:32 AM, Aaron Meurer <[email protected]> wrote: >> I guess it's not necessarily a good idea to auto-expand things like >> binomial(n, 5). Go ahead and open another issue for that if you want. >> Probably it should be changed to remain unevaluated, and to expand >> with expand(func=True). > > Hi Aaron, before I report that, does the doit() automatically call an > expand()? Ideally what we expect is I should get: > > t*Sum(n*(-1)**(1 + j)*binomial(1, j)*ival(j), (j, 0, 1)) + > Sum((-1)**j*binomial(0, j)*ival(j), (j, 0, 0)) + t**3*Sum(n*(-1)**(3 + > j)*(-1 + n)*(-2 + n)*binomial(3, j)*ival(j)/6, (j, 0, 3)) + > t**4*Sum(n*(-1)**(4 + j)*(-1 + n)*(-3 + n)*(-2 + n)*binomial(4, > j)*ival(j)/24, (j, 0, 4)) + t**2*Sum(n*(-1)**(2 + j)*(-1 + > n)*binomial(2, j)*ival(j)/2, (j, 0, 2)) + t**5*Sum(n*(-1)**(5 + j)*(-1 > + n)*(-4 + n)*(-3 + n)*(-2 + n)*binomial(5, j)*ival(j)/120, (j, 0, 5)) > > but with the Sums actually evaluated. BTW try copy-pasting the above > (which is nothing but the output of sstr as you had suggested) into > IPython and hitting enter, and again there is an infinite loop.
Yes, this is the exact same bug. This *is* the expression that hangs the printer. > > If I replace the Sum by summation then I get: > > t**5*(-n*(n - 4)*(n - 3)*(n - 2)*(n - 1)*ival(0)/120 + n*(n - 4)*(n - > 3)*(n - 2)*(n - 1)*ival(1)/24 - n*(n - 4)*(n - 3)*(n - 2)*(n - > 1)*ival(2)/12 + n*(n - 4)*(n - 3)*(n - 2)*(n - 1)*ival(3)/12 - n*(n - > 4)*(n - 3)*(n - 2)*(n - 1)*ival(4)/24 + n*(n - 4)*(n - 3)*(n - 2)*(n - > 1)*ival(5)/120) + t**4*(n*(n - 3)*(n - 2)*(n - 1)*ival(0)/24 - n*(n - > 3)*(n - 2)*(n - 1)*ival(1)/6 + n*(n - 3)*(n - 2)*(n - 1)*ival(2)/4 - > n*(n - 3)*(n - 2)*(n - 1)*ival(3)/6 + n*(n - 3)*(n - 2)*(n - > 1)*ival(4)/24) + t**3*(-n*(n - 2)*(n - 1)*ival(0)/6 + n*(n - 2)*(n - > 1)*ival(1)/2 - n*(n - 2)*(n - 1)*ival(2)/2 + n*(n - 2)*(n - > 1)*ival(3)/6) + t**2*(n*(n - 1)*ival(0)/2 - n*(n - 1)*ival(1) + n*(n - > 1)*ival(2)/2) + t*(-n*ival(0) + n*ival(1)) + ival(0) > > which is the same doit() output I guess. What we would expect as an > "ideal" output would be: > > t**5*binomial(n,5)*(-ival(5) + binomial... > > something like that. So if you could advise me on how exactly to word > the subject of the bug I can report it. The output is not going to factor itself. To get that, you have to call factor() on the output (or just simplify()). The bug here is that the binomial(n, 5) is automatically evaluating itself. It should remain unevaluated, except when expand(func=True) is called on it. Aaron Meurer > > -- > Shriramana Sharma > > -- > 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. > -- 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.
