Actually, n was declared to be an integer. Consider the following four sums:
#1: sum(1/3,(n,1,3)) #2: sum(Rational(1,3),(n,1,3)) #3: sum(1/n,(n,1,3)) #4: sum(Rational(1,n),(n,1,3)) #s 2 and 3 work, while #s 1 and 4 don't. This seems strange. I understand that #1 gives a result of zero because of the way that Python handles integer division, but #4 really should work. > The argument of the Rational class must be an integer. Use just an > expression with symbols, then it works as expected: > > In [1]: sum(1/n, (n, 2, 4)) > Out[1]: > 13 > ── > 12 > > Ondrej --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---