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.

Phillip

ValueError                                Traceback (most recent call
last)

C:\Phillip\Computer\Python\sympy_test.py in <module>()
      2 n= Symbol('n', integer=True)
      3 print Rational(1,2)+Rational(1,3)+Rational(1,4)
----> 4 print Sum(Rational(1,n), (n, 2, 4))
      5
      6

C:\Program Files\Python25\lib\site-packages\sympy-0.6.2n2-py2.5.egg
\sympy\core\cache.pyc in wrapper(
*args, **kw_args)
    265                 pass
    266             self.fix_allowed_types()
--> 267             new_args = tuple([template.process(a,func,i) for
(a, template, i) in zip(args, s
elf.arg_templates, range(len(args)))])
    268             assert len(args)==len(new_args)
    269             new_kw_args = {}

C:\Program Files\Python25\lib\site-packages\sympy-0.6.2n2-py2.5.egg
\sympy\core\cache.pyc in process(
self, obj, func, index)
    187             raise ValueError('%s return value must be of type
%r but got %r' % (func_src, se
lf.allowed_types, obj))
    188         if isinstance(index, (int,long)):
--> 189             raise ValueError('%s %s-th argument must be of
type %r but got %r' % (func_src,
index, self.allowed_types, obj))
    190         if isinstance(index, str):
    191             raise ValueError('%s %r keyword argument must be
of type %r but got %r' % (func_
src, index, self.allowed_types, obj))

ValueError: c:\program files\python25\lib\site-packages\sympy-0.6.2n2-
py2.5.egg\sympy\core\numbers.p
y:474:function __new__ 2-th argument must be of type (<type 'int'>,
<type 'long'>, <type 'NoneType'>
) but got n
WARNING: Failure executing file: <sympy_test.py>


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