Hauke Worpel (Sci) on Wed, 01 Jun 2011 23:11:04 +0200

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: Multiple Summation Question

I may be misunderstanding the problem, but what I would do is set up an array of k elements, each element of which is one of your summation variables. You will probably also need a second array that contains the upper limits to your summation variables.


On 2 June 2011 06:35, McLaughlin, James <jmclaughlin@wcupa.edu> wrote:

How can I set up a program to do multiple summation of the form, say,

Sum_{j_1=1}^1 Sum_{j_2=1}^2 … Sum_{j_k=1}^k  ( j_1^j_1+ j_2^j_2 + j_k^j_k) that will work for any integer k >=1?


What I would like is a single program that would compute the value of this sum for an particular, after specifying the only the value of k.

My problems are that I do not know how to write a program that creates the k different summation variables j_1, … j_k after specifying only what particular value k has, and even if I can define these summation variables, how do I set up the k-fold summation Sum_{j_1=1}^1 Sum_{j_2=1}^2 … Sum_{j_k=1}^k .


Thanks for any help.


Jimmy Mc Laughlin

PS The _expression_ ( j_1^j_1+ j_2^j_2 + j_k^j_k) above whose sum I wish to compute is just for illustration purposes, the sum I really want to compute is more complicated.