Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Extracting nested iterator values' topicStudent Support Forum > General > Archives > "Extracting nested iterator values"

Next Comment >Help | Reply To Topic
Author Comment/Response
Eduardo Lopez
05/28/12 09:14am

Hello,

I would like to create a list of all the values of the indices in the following sum:

Sum[Sum[Sum[Sum[(2 (r1-1)) (2 (r2-1)-1) (2 (r3-1)-2) (2 (r4-1)-3),{r4,r3+1,100}],{r3,r2+1,99}],{r2,r1+1,98}],{r1,2,97}]

In other words, I would like to have a flat list of all the numbers I will input into the summand (2 (r1-1)) (2 (r2-1)-1) (2 (r3-1)-2) (2 (r4-1)-3). The list would be equal to all the values the numbers {r1,r2,r3,r4} take when performing the previous sum. Thus, the list would look something like:

{{2,3,4,5},{2,3,4,6},...,{2,3,4,100},{2,3,5,6},....,{2,3,5,100},....
{97,98,99,100}}

What I'm really after is to then make this into a function lst[m_,a_] for which r1 runs from 2 to a+1, r2 runs from r1+1 to a+2, ... , and finally rm runs from r(m-1)+1 to a+m, where m and a are integers. Then, lst[m,a] would give me a list of all the combinations in the form above. The example with r1, r2, r3, r4 above corresponds to lst[4,96].

Thanks

URL: ,

Subject (listing for 'Extracting nested iterator values')
Author Date Posted
Extracting nested iterator values Eduardo Lopez 05/28/12 09:14am
Re: Extracting nested iterator values Bill Simpson 05/28/12 7:41pm
Re: Extracting nested iterator values Michael 05/28/12 8:23pm
Re: Extracting nested iterator values yehuda 05/29/12 07:38am
Next Comment >Help | Reply To Topic