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

< Previous CommentHelp | Reply To Comment | Reply To Topic
Author Comment/Response
yehuda
05/29/12 07:38am

First, Sum (as well as other iterator based functions such as Table, Do, etc.) handles multiple iterators, just replace their order

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

as for your specific questions - replace Sum with Table and flatten it down to the third level

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

yehuda

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
< Previous CommentHelp | Reply To Comment | Reply To Topic