On Thu, Jul 30, 2009 at 4:31 PM, Phillip M. Feldman<[email protected]> wrote: > > I tried to construct a simple sum based on the examples in > test_sums_products.py; here's my code: > > from sympy import * > n= Symbol('n', integer=True) > print Rational(1,2)+Rational(1,3)+Rational(1,4) > print sum(Rational(1,n), (n, 2, 4)) > > The first print statement gives the correct result, 13/12. > > The second print statement generates the errors shown below. I'll be > grateful for any suggestions.
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 [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 -~----------~----~----~----~------~----~------~--~---
