Mathematica 9 is now available

FoldList

Usage

FoldList[f, x,  a, b, ...  ] 给出  x, f[x, a], f[f[x, a], b], ...  .


Notes

• 例如: FoldList[f, x,  a, b, c ]LongRightArrow .
FoldList[Plus, 0, list] 产生在list中的元素的累积和。
• 例如: FoldList[Plus, 0,  a, b, c ]LongRightArrow .
• 在一个长度为  的列表中,FoldList产生一个长度为  的列表。
FoldList[f, x, list]list的头不必是List
• 参见 Mathematica 全书: 2.2.2节.
• 同时参见: Fold, 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]=



Any questions about topics on this page? Click here to get an individual response.Buy NowMore Information
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.