On Sun, Nov 18, 2012 at 3:03 PM, Shriramana Sharma <samj...@gmail.com> wrote:
> I'll be back with more queries later. :-)

OK so here's my next query on the same thread:

In [1]: from sympy import *
   ...: i,j=symbols('i j',integer=True)
   ...: lamb=list(symbols('lamb:4'))
   ...: n=3
   ...: summation(lamb[i]*(-1)**(n-j)*binomial(i,n-j),(i,n-j,n))
   ...:
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
/mnt/sda7/samjnaa-precise/<ipython-input-1-0af017dc9283> in <module>()
      3 lamb=list(symbols('lamb:4'))
      4 n=3
----> 5 summation(lamb[i]*(-1)**(n-j)*binomial(i,n-j),(i,n-j,n))
      6

TypeError: list indices must be integers, not Symbol

OK so since lamb is a Python list and not a SymPy list (is there such
a thing?) Python tries to dereference it using i and throws the error.
Basically I want to do a summation of lamb0 ... lamb3 with the
appropriate coefficients. What to do?

Thanks!

-- 
Shriramana Sharma

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

Reply via email to