Re: dynamic nested loops
- To: mathgroup at smc.vnet.net
- Subject: [mg122860] Re: dynamic nested loops
- From: Peter Pein <petsie at dordos.net>
- Date: Sat, 12 Nov 2011 07:36:54 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
- References: <j9irsq$8g5$1@smc.vnet.net>
Am 11.11.2011 11:03, schrieb Ron: >... I could construct a list {{i,imin,imax},{j, jmin, jmax}, ...{}} but "Sum" doen't know what to do with the outside braces{...}. > ANy suggestions would be much appreciated. > If you've got such a list, let "Apply" remove the the outer curly braces ;-) e.g.: In[1]:= Sum[f[i,j,k],##]& @@ {{i, 1, 3}, {j, 1, 2}, {k, 5, 4, -1}} Out[1]= f[1, 1, 4] + f[1, 1, 5] + f[1, 2, 4] + f[1, 2, 5] + f[2, 1, 4] + f[2, 1, 5] + f[2, 2, 4] + f[2, 2, 5] + f[3, 1, 4] + f[3, 1, 5] + f[3, 2, 4] + f[3, 2, 5]