Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #1995
| From | Bill Rowe <readnews@sbcglobal.net> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: How to create such a list |
| Date | 2011-04-29 11:34 +0000 |
| Organization | Steven M. Christensen and Associates, Inc and MathTensor, Inc. |
| Message-ID | <ipe7nk$r2l$1@smc.vnet.net> (permalink) |
On 4/28/11 at 6:37 AM, dominic.woerner@mpi-hd.mpg.de (Dominic
Woerner) wrote:
>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?
Easily done with:
In[5]:= FoldList[Plus, 0, Table[w[n], {n, 4}]]
Out[5]= {0,w(1),w(1)+w(2),w(1)+w(2)+w(3),w(1)+w(2)+w(3)+w(4)}
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: How to create such a list Bill Rowe <readnews@sbcglobal.net> - 2011-04-29 11:34 +0000
csiph-web