 |
FoldList
FoldList[
f
,
x
,
a
,
b
, ...
] gives
x
,
f
[
x
,
a
],
f
[
f
[
x
,
a
],
b
], ... .
Example: FoldList[f, x,
a, b, c
] . FoldList[Plus,
0,
list
] generates cumulative sums of the elements in list. Example: FoldList[Plus, 0,
a, b, c
] . With a length list, FoldList generates a list of length . The head of list in FoldList[
f
,
x
,
list
] need not be List. See the Mathematica book: Section 2.2.2. See also: NestList, ComposeList, Partition, MapIndexed.
Further Examples
This gives a list of cumulative sums.
In[1]:= 
Out[1]= 
For the cumulative products you have to start with .
In[2]:= 
Out[2]= 
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT. SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION. | | | |
 | |
|