1 | initial version |
You cannot use directly a_in but must first go through a string "a_{}{}".format(i,n) to generate the variable name and then use the function eval to get the symbolic variable:
sum(eval("a_{}{}".format(i,n))*binomial(5,i)*binomial(5,n) for i in [0..5] for n in [0..5])