Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #2001
| From | Peter Breitfeld <phbrf@t-online.de> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: How to create such a list |
| Date | 2011-04-29 11:35 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <ipe7qa$r4n$1@smc.vnet.net> (permalink) |
| 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
Back to comp.soft-sys.math.mathematica | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to create such a list Dominic Woerner <dominic.woerner@mpi-hd.mpg.de> - 2011-04-28 10:37 +0000 Re: How to create such a list Peter Breitfeld <phbrf@t-online.de> - 2011-04-29 11:35 +0000 Re: How to create such a list Stefan <wutchamacallit27@gmail.com> - 2011-04-29 11:29 +0000
csiph-web