On Thu, Mar 25, 2010 at 9:20 AM, Freddie Witherden
<fred...@witherden.org> wrote:
> Hi all,
>
> On 24 Mar 2010, at 18:58, Ondrej Certik wrote:
>> Here is one way (thanks again to Fernando for implementing the symarray!):
>>
>> In [1]: s = 17
>>
>> In [2]: Bi1 = symarray(s, "B")
>>
>> In [3]: Ci1 = symarray(s, "C")
>>
>> In [4]: Add(*(Bi1*Ci1**4)) - S(1)/5
>> Out[4]:
>>            4        4          4          4          4          4          4
>> -1/5 + B₀⋅C₀  + B₁⋅C₁  + B₁₀⋅C₁₀  + B₁₁⋅C₁₁  + B₁₂⋅C₁₂  + B₁₃⋅C₁₃  + B₁₄⋅C₁₄
>>
>>         4          4        4        4        4        4        4        4
>> + B₁₅⋅C₁₅  + B₁₆⋅C₁₆  + B₂⋅C₂  + B₃⋅C₃  + B₄⋅C₄  + B₅⋅C₅  + B₆⋅C₆  + B₇⋅C₇  +
>>
>>     4        4
>> B₈⋅C₈  + B₉⋅C₉
>
> How would you recommend handling multiple summations, such as 
> sum(sum(B[i]*A[i,j]*C[j],j,1,i),i,1,s)?

symarray allows multidimensional arrays, see symarray?, so you can try
to use that. I don't have time now to do it myself.

Ondrej

-- 
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sy...@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