WOLFRAM

Accumulate[list]

gives a list of the successive accumulated totals of elements in list.

Details and Options

Examples

open allclose all

Basic Examples  (2)Summary of the most common use cases

Cumulative sums:

Out[1]=1

Accumulate within columns:

Out[1]=1

Scope  (3)Survey of the scope of standard use cases

Accumulate a regularly sampled TimeSeries:

Out[2]=2

The created time stamps are regularly spaced:

Out[3]=3

Accumulate:

Out[4]=4

Path:

Out[5]=5

Compare to the accumulated values:

Out[6]=6

Accumulate an irregularly sampled time series:

Out[2]=2

Accumulate values:

Out[3]=3

Or define a new time series and set TemporalRegularity to True:

The path has not changed:

Out[5]=5

Now the result of Accumulate is given as a TimeSeries:

Out[6]=6
Out[7]=7

Accumulate data involving quantities:

Out[1]=1
Out[2]=2

Generalizations & Extensions  (1)Generalized and extended use cases

The head does not need to be List:

Out[1]=1

Applications  (4)Sample problems that can be solved with this function

Triangular numbers:

Out[1]=1

Random walk:

Out[1]=1

Idealized random mountainside:

Out[1]=1

Cumulative sums of terms in a series:

Out[1]=1
Out[2]=2

Properties & Relations  (3)Properties of the function, and connections to other functions

Differences is almost the inverse of Accumulate:

Out[1]=1
Out[2]=2

Accumulate is equivalent to a particular case of FoldList:

Out[1]=1
Out[2]=2

Use Sum to symbolically accumulate sequences:

Out[1]=1
Out[2]=2
Out[3]=3

Possible Issues  (1)Common pitfalls and unexpected behavior

Accumulating directly an irregularly sampled time series may differ from accumulating the values:

Out[3]=3

Path:

Out[4]=4

Check if regularly sampled:

Out[5]=5

Accumulate the time series:

Out[6]=6
Out[7]=7

This is not the same as the accumulated values:

Out[8]=8

The time series was first upsampled according to MinimumTimeIncrement and then downsampled:

Out[11]=11
Out[12]=12

Assume temporal regularity to simply accumulate the values:

Out[13]=13
Out[14]=14
Out[15]=15
Out[16]=16
Out[17]=17

Neat Examples  (1)Surprising or curious use cases

Diagonals of Pascal's triangle:

Out[1]=1
Wolfram Research (2007), Accumulate, Wolfram Language function, https://reference.wolfram.com/language/ref/Accumulate.html (updated 2008).
Wolfram Research (2007), Accumulate, Wolfram Language function, https://reference.wolfram.com/language/ref/Accumulate.html (updated 2008).

Text

Wolfram Research (2007), Accumulate, Wolfram Language function, https://reference.wolfram.com/language/ref/Accumulate.html (updated 2008).

Wolfram Research (2007), Accumulate, Wolfram Language function, https://reference.wolfram.com/language/ref/Accumulate.html (updated 2008).

CMS

Wolfram Language. 2007. "Accumulate." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2008. https://reference.wolfram.com/language/ref/Accumulate.html.

Wolfram Language. 2007. "Accumulate." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2008. https://reference.wolfram.com/language/ref/Accumulate.html.

APA

Wolfram Language. (2007). Accumulate. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Accumulate.html

Wolfram Language. (2007). Accumulate. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/Accumulate.html

BibTeX

@misc{reference.wolfram_2025_accumulate, author="Wolfram Research", title="{Accumulate}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/Accumulate.html}", note=[Accessed: 30-April-2025 ]}

@misc{reference.wolfram_2025_accumulate, author="Wolfram Research", title="{Accumulate}", year="2008", howpublished="\url{https://reference.wolfram.com/language/ref/Accumulate.html}", note=[Accessed: 30-April-2025 ]}

BibLaTeX

@online{reference.wolfram_2025_accumulate, organization={Wolfram Research}, title={Accumulate}, year={2008}, url={https://reference.wolfram.com/language/ref/Accumulate.html}, note=[Accessed: 30-April-2025 ]}

@online{reference.wolfram_2025_accumulate, organization={Wolfram Research}, title={Accumulate}, year={2008}, url={https://reference.wolfram.com/language/ref/Accumulate.html}, note=[Accessed: 30-April-2025 ]}