Re: How to create such a list
- To: mathgroup at smc.vnet.net
- Subject: [mg118495] Re: How to create such a list
- From: Peter Breitfeld <phbrf at t-online.de>
- Date: Fri, 29 Apr 2011 07:35:49 -0400 (EDT)
- References: <ipbg0i$agm$1@smc.vnet.net>
Dominic Woerner wrote: > Hi, > > I like to create a list of the form: > 0,w[1],...,w[n],w[1]+w[2],...,w[1]+w[n],w[2]+w[3],......,w[1]+...+w[n] > for arbitrary n > Is there a neat way to do this? > > Cheers, > Dominic > Try this: wArr[s_,e_]:=Array[w,e-s+1,s] createList[n_]:=Table[wArr[i,n],{i,0,n}]//Flatten createList[4] Out= {w[0], w[1], w[2], w[3], w[4], w[1], w[2], w[3], w[4], w[2], w[3], w[4], w[3], w[4], w[4]} -- _________________________________________________________________ Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de