Re: building a list containing elements f(i,j)
- To: mathgroup at smc.vnet.net
- Subject: [mg71079] Re: [mg71045] building a list containing elements f(i,j)
- From: János <janos.lobb at yale.edu>
- Date: Wed, 8 Nov 2006 06:13:00 -0500 (EST)
- References: <200611060752.CAA08745@smc.vnet.net>
On Nov 6, 2006, at 2:52 AM, xarnaudx at gmail.com wrote: > > hi, > i want to construct a list of the form: > { f[1,1], ... f[n,m] } > So the list contains elements of the form f[i,j] with i ranging from 0 > to n, and j from 0 to somebound[i]. > > What would be the most elegant way to this? > thanks Here is newbie elegancy: In[1]:= n = 4; In[2]:= Flatten[Table[Table[f[i, j], {j, 0, i}], {i, 0, n}]] Out[2]= {f[0, 0], f[1, 0], f[1, 1], f[2, 0], f[2, 1], f[2, 2], f[3, 0], f[3, 1], f[3, 2], f[3, 3], f[4, 0], f[4, 1], f[4, 2], f[4, 3], f[4, 4]} János ---------------------------------------------- Trying to argue with a politician is like lifting up the head of a corpse. (S. Lem: His Master Voice)
- References:
- building a list containing elements f(i,j)
- From: "xarnaudx@gmail.com" <xarnaudx@gmail.com>
- building a list containing elements f(i,j)